T
- Indicates the type being unmarshalled by this response handler.public class StaxResponseHandler<T> extends java.lang.Object implements HttpResponseHandler<AmazonWebServiceResponse<T>>
Modifier and Type | Field and Description |
---|---|
private static org.apache.commons.logging.Log |
log
Shared logger for profiling information
|
private Unmarshaller<T,StaxUnmarshallerContext> |
responseUnmarshaller
The StAX unmarshaller to use when handling the response
|
private static javax.xml.stream.XMLInputFactory |
xmlInputFactory
Shared factory for creating XML event readers
|
X_AMZN_REQUEST_ID_HEADER
Constructor and Description |
---|
StaxResponseHandler(Unmarshaller<T,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.
|
Modifier and Type | Method and 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(StaxUnmarshallerContext unmarshallerContext)
Hook for subclasses to override in order to collect additional metadata
from service responses.
|
private Unmarshaller<T,StaxUnmarshallerContext> responseUnmarshaller
private static final org.apache.commons.logging.Log log
private static final javax.xml.stream.XMLInputFactory xmlInputFactory
public StaxResponseHandler(Unmarshaller<T,StaxUnmarshallerContext> responseUnmarshaller)
responseUnmarshaller
- The StAX unmarshaller to use on the response.public AmazonWebServiceResponse<T> handle(HttpResponse response) throws java.lang.Exception
HttpResponseHandler
handle
in interface HttpResponseHandler<AmazonWebServiceResponse<T>>
response
- The HTTP response to handle, as received from an AWS service.java.lang.Exception
- If any problems are encountered handling the response.HttpResponseHandler.handle(com.amazonaws.http.HttpResponse)
protected void registerAdditionalMetadataExpressions(StaxUnmarshallerContext unmarshallerContext)
unmarshallerContext
- The unmarshaller context used to configure a service's response
data.public boolean needsConnectionLeftOpen()
needsConnectionLeftOpen
in interface HttpResponseHandler<AmazonWebServiceResponse<T>>
HttpResponseHandler.needsConnectionLeftOpen()