|
Resources
Sample Code and Libraries
Amazon S3 Library for REST in Java
Posts:
3
Registered:
1/14/08
|
|
|
|
Amazon S3 Library for REST in Java
Posted:
Apr 27, 2008 8:10 AM PDT
|
|
|
The problem described in one of the reviews below is still a problem for me with java version 1.5.0. Specifically:
$ javac S3Driver.java
----------
1. ERROR in ...s3-example-libraries/java/./com/amazon/s3/ListBucketResponse.java (at line 169)
this.isTruncated = Boolean.valueOf(this.currText.toString());
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Type mismatch: cannot convert from Boolean to boolean
----------
1 problem (1 error)
Making the following change corrected the error:
/*wrong* this.isTruncated = Boolean.valueOf(this.currText.toString()); ********/
/*right*/ this.isTruncated = Boolean.valueOf(this.currText.toString()).booleanValue();
|
|
Posts:
2
Registered:
2/29/08
|
|
|
|
Re: Amazon S3 Library for REST in Java
Posted:
Jun 10, 2008 2:16 PM PDT
in response to: A Simak fan
|
|
|
I was having a problem with connections not closing, in the event of a file not found. This was mentioned below in the reviews, I was able to fix by slurping the input stream from the 400+ status code response as well, which allows the connection to close properly. This was causing a lot of problems in our app!
<pre>
public GetResponse(HttpURLConnection connection) throws IOException {
super(connection);
if (connection.getResponseCode() < 400) {
Map metadata = extractMetadata(connection);
byte[] body = slurpInputStream(connection.getInputStream());
this.object = new S3Object(body, metadata);
} else {
byte[] errBody = slurpInputStream(connection.getErrorStream());
}
}
</pre>
|
|
Posts:
6
Registered:
12/28/08
|
|
|
|
Importing the library into eclipse
Posted:
Dec 28, 2008 10:44 PM PST
in response to: A Simak fan
|
|
|
I seem to be having trouble getting the com.amazon.* libraries to recognize by eclipse. I jar-ed them up and added them as external jars, but it still can't seem to recognize them. Any suggestions?
|
|
Posts:
1
Registered:
3/2/09
|
|
|
|
Re: Amazon S3 Library for REST in Java
Posted:
Mar 2, 2009 7:33 AM PST
in response to: A Simak fan
|
|
|
|
|
Attached is an Ant script. If you use Groovy, you can use this scriptto open a console, which will allow you to run all of the documentationexamples in real-time and see the output. Handy for creating buckets& doing other maintenance.
|
|
|
|
Where is the beef?, Nov 14, 2006 6:30 PM
Reviewer: ObjectWorks Media
Where is the download?
|
|
Code provided does not compile in Sun JDK 1.4.2_13, Jan 18, 2007 3:43 AM
Reviewer: seeknew
The code provided does not compile in Sun JDK 1.4.2_13.
Line # 169 in ListBucketResponse.java throws an error. Method parseBoolean in class Boolean is introduced in JDK 1.5 onwards.
|
|
Worked with Java 1.5, Feb 13, 2007 10:47 AM
Reviewer: Marlon Pierce
Java 1.5 worked fine, but 1.4.2 has the same error reported earlier.
The readme has almost no instructions on how to compile and run.
To do the thing on linux,
0. unpack it and cd into s3-example-libraries/java.
1. Edit both S3Driver.java and S3Test.java to use your access ID key and secret key.
2. Compile with
find . -name "*.java"| xargs javac -d .
3. Run tests with
java -cp . S3Test
and then run the example with
java -cp . S3Drive
|
|
Make sure to read the response., Mar 12, 2007 1:07 PM
Reviewer: ninjacodersass
One thing I noticed while using this library -- you need to make sure to read the response from your get, put or delete request. Otherwise, the HTTP request won't be completed (or perhaps even sent) by HttpURLConnection. Calling just awsAuthConnection.delete(fooBucket, fooObject, null) will probably not delete your object, but awsAuthConnection.delete(fooBucket, fooObject, null).connection.getResponseMessage() will. This caveat could have been better documented. Otherwise, this is a pretty easy-to-use library for somebody just getting started with S3.
|
|
thanks 1m ninjacodersass, Sep 8, 2007 12:21 AM
Reviewer: mariacheese
never would have figured out to read the response... cool.
|
|
Where is the definitive copy of this code located? is it in any Maven repository?, Sep 10, 2007 10:52 AM
Reviewer: Brian Coan
I've seen this code for AWSAuthConnection, etc. in several different places now (the Eclipse plugin for one).
Where is the definitive source, is this it? is it somewhere packaged in a versioned jar that's being maintained?
is it available via a Maven repository?
Thanks
|
|
Simple but very limited., Jan 25, 2009 12:41 PM
Reviewer: dariojogatina
From the documentation:
"One of the main limitations of these sample AWSAuthConnection implementations
is that the interfaces are not streaming." <-- UNACCEPTABLE, IMPRACTICAL FOR MOST USES.
"These libraries have nearly non-existent error handling" <-- BAD IMPLEMENTATION
Besides the two no-nos above, should be OK.
|
|
|
|
 |
|
|