Package com.amazonaws.http
Class DefaultErrorResponseHandler
java.lang.Object
com.amazonaws.http.DefaultErrorResponseHandler
- All Implemented Interfaces:
HttpResponseHandler<AmazonServiceException>
public class DefaultErrorResponseHandler
extends Object
implements HttpResponseHandler<AmazonServiceException>
Implementation of HttpResponseHandler that handles only error responses from
Amazon Web Services. A list of unmarshallers is passed into the constructor,
and while handling a response, each unmarshaller is tried, in order, until
one is found that can successfully unmarshall the error response. If no
unmarshaller is found that can unmarshall the error response, a generic
AmazonServiceException is created and populated with the AWS error response
information (error message, AWS error code, AWS request ID, etc).
-
Field Summary
Fields inherited from interface com.amazonaws.http.HttpResponseHandler
X_AMZN_REQUEST_ID_HEADER
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultErrorResponseHandler
(List<com.amazonaws.transform.Unmarshaller<AmazonServiceException, Node>> unmarshallerList) Constructs a new DefaultErrorResponseHandler that will handle error responses from Amazon services using the specified list of unmarshallers. -
Method Summary
Modifier and TypeMethodDescriptionhandle
(HttpResponse errorResponse) Accepts an HTTP response object, and returns an object of type T.boolean
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.
-
Constructor Details
-
DefaultErrorResponseHandler
public DefaultErrorResponseHandler(List<com.amazonaws.transform.Unmarshaller<AmazonServiceException, Node>> unmarshallerList) Constructs a new DefaultErrorResponseHandler that will handle error responses from Amazon services using the specified list of unmarshallers. Each unmarshaller will be tried, in order, until one is found that can unmarshall the error response.- Parameters:
unmarshallerList
- The list of unmarshallers to try using when handling an error response.
-
-
Method Details
-
handle
Description copied from interface:HttpResponseHandler
Accepts an HTTP response object, and returns an object of type T. Individual implementations may choose to handle the response however they need to, and return any type that they need to.- Specified by:
handle
in interfaceHttpResponseHandler<AmazonServiceException>
- Parameters:
errorResponse
- The HTTP response to handle, as received from an AWS service.- Returns:
- An object of type T, as defined by individual implementations.
- Throws:
Exception
- If any problems are encountered handling the response.
-
needsConnectionLeftOpen
public 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.- Specified by:
needsConnectionLeftOpen
in interfaceHttpResponseHandler<AmazonServiceException>
- Returns:
- True if this response handler requires that the underlying HTTP connection be left open, and not automatically closed, otherwise false.
- See Also:
-