public class DefaultErrorResponseHandler extends java.lang.Object implements HttpResponseHandler<AmazonServiceException>
Modifier and Type | Field and Description |
---|---|
private static org.apache.commons.logging.Log |
log |
private java.util.List<Unmarshaller<AmazonServiceException,org.w3c.dom.Node>> |
unmarshallerList
The list of error response unmarshallers to try to apply to error
responses.
|
X_AMZN_REQUEST_ID_HEADER
Constructor and Description |
---|
DefaultErrorResponseHandler(java.util.List<Unmarshaller<AmazonServiceException,org.w3c.dom.Node>> unmarshallerList)
Constructs a new DefaultErrorResponseHandler that will handle error
responses from Amazon services using the specified list of unmarshallers.
|
Modifier and Type | Method and Description |
---|---|
AmazonServiceException |
handle(HttpResponse errorResponse)
Accepts an HTTP response object, and returns an object of type T.
|
boolean |
needsConnectionLeftOpen()
Since this response handler completely consumes all the data from the
underlying HTTP connection during the handle method, we don't need to
keep the HTTP connection open.
|
private AmazonServiceException |
newAmazonServiceException(java.lang.String errmsg,
HttpResponse httpResponse,
java.lang.Exception readFailure)
Used to create an
newAmazonServiceException when we failed to
read the error response or parsed the error response as XML. |
private static final org.apache.commons.logging.Log log
private java.util.List<Unmarshaller<AmazonServiceException,org.w3c.dom.Node>> unmarshallerList
public DefaultErrorResponseHandler(java.util.List<Unmarshaller<AmazonServiceException,org.w3c.dom.Node>> unmarshallerList)
unmarshallerList
- The list of unmarshallers to try using when handling an error
response.public AmazonServiceException handle(HttpResponse errorResponse) throws java.lang.Exception
HttpResponseHandler
handle
in interface HttpResponseHandler<AmazonServiceException>
errorResponse
- The HTTP response to handle, as received from an AWS service.java.lang.Exception
- If any problems are encountered handling the response.private AmazonServiceException newAmazonServiceException(java.lang.String errmsg, HttpResponse httpResponse, java.lang.Exception readFailure)
newAmazonServiceException
when we failed to
read the error response or parsed the error response as XML.public boolean needsConnectionLeftOpen()
needsConnectionLeftOpen
in interface HttpResponseHandler<AmazonServiceException>
HttpResponseHandler.needsConnectionLeftOpen()