com.netease.cloud.http
public class DefaultErrorResponseHandler extends Object implements HttpResponseHandler<ServiceException>
Constructor and Description |
---|
DefaultErrorResponseHandler(List<Unmarshaller<ServiceException,Node>> unmarshallerList)
Constructs a new DefaultErrorResponseHandler that will handle error
responses from services using the specified list of unmarshallers.
|
Modifier and Type | Method and Description |
---|---|
ServiceException |
handle(HttpResponse errorResponse)
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.
|
public DefaultErrorResponseHandler(List<Unmarshaller<ServiceException,Node>> unmarshallerList)
unmarshallerList
- The list of unmarshallers to try using when handling an error
response.public ServiceException handle(HttpResponse errorResponse) throws Exception
HttpResponseHandler
handle
in interface HttpResponseHandler<ServiceException>
errorResponse
- The HTTP response to handle, as received from an service.Exception
- If any problems are encountered handling the response.public boolean needsConnectionLeftOpen()
needsConnectionLeftOpen
in interface HttpResponseHandler<ServiceException>
HttpResponseHandler.needsConnectionLeftOpen()
Copyright © 2017. All Rights Reserved.