Package com.amazonaws.http
Class StaxResponseHandler<T>
- java.lang.Object
-
- com.amazonaws.http.StaxResponseHandler<T>
-
- Type Parameters:
T
- Indicates the type being unmarshalled by this response handler.
- All Implemented Interfaces:
HttpResponseHandler<AmazonWebServiceResponse<T>>
public class StaxResponseHandler<T> extends Object implements HttpResponseHandler<AmazonWebServiceResponse<T>>
Default implementation of HttpResponseHandler that handles a successful response from an AWS service and unmarshalls the result using a StAX unmarshaller.
-
-
Field Summary
-
Fields inherited from interface com.amazonaws.http.HttpResponseHandler
X_AMZN_REQUEST_ID_HEADER
-
-
Constructor Summary
Constructors Constructor Description StaxResponseHandler(com.amazonaws.transform.Unmarshaller<T,com.amazonaws.transform.StaxUnmarshallerContext> responseUnmarshaller)
Constructs a new response handler that will use the specified StAX unmarshaller to unmarshall the service response and uses the specified response element path to find the root of the business data in the service's response.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AmazonWebServiceResponse<T>
handle(HttpResponse response)
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.protected void
registerAdditionalMetadataExpressions(com.amazonaws.transform.StaxUnmarshallerContext unmarshallerContext)
Hook for subclasses to override in order to collect additional metadata from service responses.
-
-
-
Constructor Detail
-
StaxResponseHandler
public StaxResponseHandler(com.amazonaws.transform.Unmarshaller<T,com.amazonaws.transform.StaxUnmarshallerContext> responseUnmarshaller)
Constructs a new response handler that will use the specified StAX unmarshaller to unmarshall the service response and uses the specified response element path to find the root of the business data in the service's response.- Parameters:
responseUnmarshaller
- The StAX unmarshaller to use on the response.
-
-
Method Detail
-
handle
public AmazonWebServiceResponse<T> handle(HttpResponse response) throws Exception
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<T>
- Parameters:
response
- 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.- See Also:
HttpResponseHandler.handle(com.amazonaws.http.HttpResponse)
-
registerAdditionalMetadataExpressions
protected void registerAdditionalMetadataExpressions(com.amazonaws.transform.StaxUnmarshallerContext unmarshallerContext)
Hook for subclasses to override in order to collect additional metadata from service responses.- Parameters:
unmarshallerContext
- The unmarshaller context used to configure a service's response data.
-
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<T>
- Returns:
- True if this response handler requires that the underlying HTTP connection be left open, and not automatically closed, otherwise false.
- See Also:
HttpResponseHandler.needsConnectionLeftOpen()
-
-