Project

General

Profile

Statistics
| Revision:

root / trunk / web / dojo / dojox / data / s3 / README @ 11

History | View | Annotate | Download (1.43 KB)

1 9 andrej.cim
Using Amazon S3 with Dojo has the following prerequisites:
2
    * You must be signed up to use Amazon S3. You can sign up for Amazon S3 at http://aws.amazon.com/s3.
3
    * Use the provided proxy (/dojox/rpc/s3/proxy.php) with PHP 5.
4
    * proxy.php requires the following modules:
5
          o Crypt_HMAC
6
          o HTTP_Request
7
8
9
To use S3 from Dojo, you need a proxy. You can use the provided proxy example file by renaming
10
proxy.example-php to proxy.php and then you must enter your Amazon access key and secret access key
11
into the proxy.php file on line 3 and 4:
12
13
$accessKey = "access key";
14
$secretAccessKey = "secret access key";
15
16
You then use the Dojo RPC service with the "PROXIED-PATH" envelope:
17
18
dojo.require("dojox.rpc.Service");
19
dojo.require("dojox.rpc.ProxiedPath");
20
var s3Buckets = new dojox.rpc.Service({
21
	target:"http://s3.amazonaws.com/",
22
	proxyUrl:"../s3/proxy.php", // the path to the proxy
23
	transport:"REST",
24
	envelope:"PROXIED-PATH",
25
	contentType:"application/json",
26
	services:{
27
		myBucket:{
28
			target:"myBucket",
29
			parameters:[{type:"string"}]
30
		}
31
	}
32
});
33
34
35
To use the S3 as a Dojo data store you can use the S3JsonRestStore module. First setup an RPC service
36
as shown above and then pass the RPC service to the S3JsonRestStore:
37
38
dojo.require("dojox.data.S3JsonRestStore");
39
s3Store = new dojox.data.S3JsonRestStore({service:s3Buckets.myBucket}); // and create a store for it
40
41
You can then use the s3Store as a normal Read/Write Dojo Data store.