com.amazonaws.http
Class JsonResponseHandler<T>

java.lang.Object
  extended by com.amazonaws.http.JsonResponseHandler<T>
Type Parameters:
T - Indicates the type being unmarshalled by this response handler.
All Implemented Interfaces:
HttpResponseHandler<AmazonWebServiceResponse<T>>

public class JsonResponseHandler<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 JSON unmarshaller.


Field Summary
 boolean needsConnectionLeftOpen
           
 
Constructor Summary
JsonResponseHandler(com.amazonaws.transform.Unmarshaller<T,com.amazonaws.transform.JsonUnmarshallerContext> responseUnmarshaller)
          Constructs a new response handler that will use the specified JSON 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
 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.JsonUnmarshallerContext unmarshallerContext)
          Hook for subclasses to override in order to collect additional metadata from service responses.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

needsConnectionLeftOpen

public boolean needsConnectionLeftOpen
Constructor Detail

JsonResponseHandler

public JsonResponseHandler(com.amazonaws.transform.Unmarshaller<T,com.amazonaws.transform.JsonUnmarshallerContext> responseUnmarshaller)
Constructs a new response handler that will use the specified JSON 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 JSON 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 interface HttpResponseHandler<AmazonWebServiceResponse<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.JsonUnmarshallerContext unmarshallerContext)
Hook for subclasses to override in order to collect additional metadata from service responses.

Parameters:
unmarshallerContext - The unmarshaller context used to process 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 interface HttpResponseHandler<AmazonWebServiceResponse<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()


Copyright © 2016. All rights reserved.