webui-aria2/js/libs/dojox/data/s3/README
2012-05-01 19:52:07 +08:00

42 lines
1.4 KiB
Plaintext

Using Amazon S3 with Dojo has the following prerequisites:
* You must be signed up to use Amazon S3. You can sign up for Amazon S3 at http://aws.amazon.com/s3.
* Use the provided proxy (/dojox/rpc/s3/proxy.php) with PHP 5.
* proxy.php requires the following modules:
o Crypt_HMAC
o HTTP_Request
To use S3 from Dojo, you need a proxy. You can use the provided proxy example file by renaming
proxy.example-php to proxy.php and then you must enter your Amazon access key and secret access key
into the proxy.php file on line 3 and 4:
$accessKey = "access key";
$secretAccessKey = "secret access key";
You then use the Dojo RPC service with the "PROXIED-PATH" envelope:
dojo.require("dojox.rpc.Service");
dojo.require("dojox.rpc.ProxiedPath");
var s3Buckets = new dojox.rpc.Service({
target:"http://s3.amazonaws.com/",
proxyUrl:"../s3/proxy.php", // the path to the proxy
transport:"REST",
envelope:"PROXIED-PATH",
contentType:"application/json",
services:{
myBucket:{
target:"myBucket",
parameters:[{type:"string"}]
}
}
});
To use the S3 as a Dojo data store you can use the S3JsonRestStore module. First setup an RPC service
as shown above and then pass the RPC service to the S3JsonRestStore:
dojo.require("dojox.data.S3JsonRestStore");
s3Store = new dojox.data.S3JsonRestStore({service:s3Buckets.myBucket}); // and create a store for it
You can then use the s3Store as a normal Read/Write Dojo Data store.