[ REST WITH AMAZON ’ S S3 ] Amazon AWS
Byte [] file = “ Hello , world ”. getBytes ();
Response putResponse = conn . put ( “ MyBucket ”, “ MyObject ”, new S3Object ( file , null ), null );
To retrieve this new object , a GET HTTP request can be used .
Note : GET is used both to retrieve bucket information ( such as a list of all objects in a bucket ), but to also retrieve the actual contents of the object .
PROBLEMS
The following problems each use a sample data set that is generated by the attached Java program “ InstallS3 . java ”. Follow the instructions in the document “ Getting Started with Amazon ’ s Web Services for Lessons Plans ” for getting an Amazon Web Services account and setting up your system .
1 . Java ’ s standard API for building a REST-based web service is defined in JSR 311 , also known as JAX-RS . Implement a REST-based API that is similar to Amazon ’ s S3 . Save the content inmemory .
2 . Update your REST-based service from # 1 to use S3 as a backing store .
3 . Bonus question : JSR 311 allows for content-type-based negotiation . For instance , a client may state a preference for text / xml , but also accept text / plain . Update your implementation from # 2 to support storing structured data ( such as XML or CSV files ) and output based on requested content-type ( for instance , transform the content using XSLT or similar means .) Extra bonus : support JSON in addition to XML for bucket / folder properties .
Page 3 of 3