Hi
I am trying to upload files to Amazon S3 from Google App Engine (in Java) using the URLFetchService, but I am not getting very far. For a start I have never done any REST programming before, nor GAE.
I have looked through the documentation for S3, and have come up with the following code. Am I going along the right path?
final URLFetchService urlFetchService = URLFetchServiceFactory.getURLFetchService();
final URL url = new URL("http", AWS_BUCKET+".s3.amazonaws.com/myFile.jpg", "");
final HTTPRequest request = new HTTPRequest(url, HTTPMethod.PUT, followRedirects());
request.addHeader(new HTTPHeader("Content-Type", contentType));
request.addHeader(new HTTPHeader("Content-Length", Integer.toString(pictureBytes.length)));
request.addHeader(new HTTPHeader("Expect", "100-continue"));
request.addHeader(new HTTPHeader("Authorization", "AWS "+AWS_ACCESS_KEY+":"+AWS_SECRET_KEY));
request.setPayload(pictureBytes);
urlFetchService.fetch(request);
When I run the above code, I get Entity enclosing requests cannot be redirected without user intervention
as an error message.
Thanks in advance for any hints/tips/pointers/URLs/solutions :)
Cheers
Rich