public class JsonResponseHandler<T> extends java.lang.Object implements HttpResponseHandler<ApiServiceResponse<T>>
| Modifier and Type | Field and Description |
|---|---|
boolean |
needsConnectionLeftOpen |
| Constructor and Description |
|---|
JsonResponseHandler(Unmarshaller<T,JsonUnmarshallerContext> 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 |
|---|---|
protected java.lang.String |
getRequestId(HttpResponse response) |
ApiServiceResponse<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(JsonUnmarshallerContext unmarshallerContext)
Hook for subclasses to override in order to collect additional metadata
from service responses.
|
public JsonResponseHandler(Unmarshaller<T,JsonUnmarshallerContext> responseUnmarshaller)
responseUnmarshaller - The StAX unmarshaller to use on the response.public ApiServiceResponse<T> handle(HttpResponse response) throws java.lang.Exception
HttpResponseHandlerhandle in interface HttpResponseHandler<ApiServiceResponse<T>>response - The HTTP response to handle, as received from request.java.lang.Exception - If any problems are encountered handling the response.protected void registerAdditionalMetadataExpressions(JsonUnmarshallerContext unmarshallerContext)
unmarshallerContext - The unmarshaller context used to process a service's response
data.public boolean needsConnectionLeftOpen()
needsConnectionLeftOpen in interface HttpResponseHandler<ApiServiceResponse<T>>true if this response handler requires that the
underlying HTTP connection be left open, and not automatically
closed, otherwise false.protected java.lang.String getRequestId(HttpResponse response)