feniix / awsgroovyclouds Goto Github PK
View Code? Open in Web Editor NEWAutomatically exported from code.google.com/p/awsgroovyclouds
Automatically exported from code.google.com/p/awsgroovyclouds
What steps will reproduce the problem?
1. Sometimes, when using a non-default location, s3 will return http 307.
Only sometimes so this takes patience to test in real life.
The 307 response from S3 contains a new host name to try to send the
request to but there is no way to choose a host using the external methods
of the lib.
Suggested fix: Change method "callS3" and add method "replaceHost" like this:
private void replaceHost( HttpMethodBase method, String newHost ) {
org.apache.commons.httpclient.URI oldUri = method.URI
String oldString = oldUri.toString()
String oldHost = oldUri.getHost()
String newString = oldString.replace( oldHost, newHost )
method.URI = new org.apache.commons.httpclient.URI( newString )
logger.info( "Changed {} to {}.", oldString, newString )
}
private def callS3(httpMethod, s3headers, List responseHeaders=null,
parseXMLResponse=true, handlerConfig=null) {
s3headers.each { k, v ->
httpMethod.setRequestHeader(k, v)
}
def (statusCode, response) = connectAWS(httpMethod,
parseXMLResponse, handlerConfig)
// retry if code is 307.
if( 307 == statusCode ) {
logger.warn( "Status code 307 (Temporary Redirect) received. Will
retry once if we were given a new endpoint." )
if( response?.Endpoint ) {
String newHost = response.Endpoint.text()
logger.warn( "Retrying with new Uri: {}", newHost )
replaceHost( httpMethod, newHost )
(statusCode, response) = connectAWS( httpMethod,
parseXMLResponse, handlerConfig )
}
}
if (parseXMLResponse) {
try {
parseResponse(response)
} catch( S3Exception s3ex ) {
throw s3ex //rethrow
}
}
def resultHeaders = getResponseHeaders(httpMethod, responseHeaders)
resultHeaders.put("StatusCode", statusCode)
return [resultHeaders, response]
}
What version of the product are you using? On what operating system?
0.8 on windows xp and ubuntu/64 9.10
Original issue reported on code.google.com by [email protected]
on 25 Feb 2010 at 9:11
What steps will reproduce the problem?
1. Call createBucket and supply a value for the location parameter.
What is the expected output? What do you see instead?
Result: groovy.lang.MissingMethodException: "No signature of method:
java.lang.String.getContentType() is applicable for argument types: ()
values: []"
What version of the product are you using? On what operating system?
0.8 on Ubuntu 9.10 64bit
Please provide any additional information below.
Line 709 in S3Driver.groovy fails because body is a String and method
getContentType() is not available for Strings.
This is the line: "def contentType = body?.getContentType()"
The body parameter is only defined if the location parameter to
createBucket is non-null as seen in lines 261-263:
if (location) {
body =
"""<CreateBucketConfiguration><LocationConstraint>${location}</LocationConstrain
t></CreateBucketConfiguration>""".toString()
}
It is then passed to putRequest on line 264:
def (headers, response) = doPutRequest(bucketName, "/", body, s3headers)
TO FIX
Lines 264-265 should probably look more like this:
def reqEntity = new StringRequestEntity(body, "text/xml", "utf-8")
def (headers,response) = doPutRequest(bucketName,"/",reqEntity,s3headers)
Original issue reported on code.google.com by [email protected]
on 23 Feb 2010 at 9:12
The issues are a year old, no documentation, no comment in the exmaple code...
not really signs of a healthy Open Source project.
Original issue reported on code.google.com by [email protected]
on 21 Feb 2011 at 12:34
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.