Class ObjectOrErrorResponseHandler<IntermediateType,FinalType>
java.lang.Object
org.apache.druid.java.util.http.client.response.ObjectOrErrorResponseHandler<IntermediateType,FinalType>
- All Implemented Interfaces:
HttpResponseHandler<Either<StringFullResponseHolder,IntermediateType>, Either<StringFullResponseHolder, FinalType>>
public class ObjectOrErrorResponseHandler<IntermediateType,FinalType>
extends Object
implements HttpResponseHandler<Either<StringFullResponseHolder,IntermediateType>,Either<StringFullResponseHolder,FinalType>>
Response handler that delegates successful responses (2xx response codes) to some other handler, but returns
errors (non-2xx response codes) as Strings. The return value is an
Either.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.druid.java.util.http.client.response.HttpResponseHandler
HttpResponseHandler.TrafficCop -
Constructor Summary
ConstructorsConstructorDescription -
Method Summary
Modifier and TypeMethodDescriptiondone(ClientResponse<Either<StringFullResponseHolder, IntermediateType>> clientResponse) Called after the final handleResponse() or handleChunk() call, signifying that no more data will arrive.voidexceptionCaught(ClientResponse<Either<StringFullResponseHolder, IntermediateType>> clientResponse, Throwable e) handleChunk(ClientResponse<Either<StringFullResponseHolder, IntermediateType>> clientResponse, org.jboss.netty.handler.codec.http.HttpChunk chunk, long chunkNum) Called for chunked responses, indicating another HttpChunk has arrived.handleResponse(org.jboss.netty.handler.codec.http.HttpResponse response, HttpResponseHandler.TrafficCop trafficCop) Handles the initial HttpResponse object that comes back from Netty.
-
Constructor Details
-
ObjectOrErrorResponseHandler
-
-
Method Details
-
handleResponse
public ClientResponse<Either<StringFullResponseHolder,IntermediateType>> handleResponse(org.jboss.netty.handler.codec.http.HttpResponse response, HttpResponseHandler.TrafficCop trafficCop) Description copied from interface:HttpResponseHandlerHandles the initial HttpResponse object that comes back from Netty.- Specified by:
handleResponsein interfaceHttpResponseHandler<IntermediateType,FinalType> - Parameters:
response- response from NettytrafficCop- flow controller, allows resuming suspended reads- Returns:
- response that may be "finished" or "unfinished".
-
handleChunk
public ClientResponse<Either<StringFullResponseHolder,IntermediateType>> handleChunk(ClientResponse<Either<StringFullResponseHolder, IntermediateType>> clientResponse, org.jboss.netty.handler.codec.http.HttpChunk chunk, long chunkNum) Description copied from interface:HttpResponseHandlerCalled for chunked responses, indicating another HttpChunk has arrived.- Specified by:
handleChunkin interfaceHttpResponseHandler<IntermediateType,FinalType> - Parameters:
clientResponse- last response returned by the prior handleResponse() or handleChunk()chunk- the new chunk of datachunkNum- the sequence number of this chunk (increases monotonically)- Returns:
- response that may be "finished" or "unfinished".
-
done
public ClientResponse<Either<StringFullResponseHolder,FinalType>> done(ClientResponse<Either<StringFullResponseHolder, IntermediateType>> clientResponse) Description copied from interface:HttpResponseHandlerCalled after the final handleResponse() or handleChunk() call, signifying that no more data will arrive.- Specified by:
donein interfaceHttpResponseHandler<IntermediateType,FinalType> - Parameters:
clientResponse- last response returned by handleResponse() or handleChunk()- Returns:
- response containing an object to hand back to the caller. It must be a "finished" response.
-
exceptionCaught
public void exceptionCaught(ClientResponse<Either<StringFullResponseHolder, IntermediateType>> clientResponse, Throwable e) - Specified by:
exceptionCaughtin interfaceHttpResponseHandler<IntermediateType,FinalType>
-