Package org.apache.http.nio.protocol
Class BufferingHttpClientHandler.ExecutionHandlerAdaptor
- java.lang.Object
-
- org.apache.http.nio.protocol.BufferingHttpClientHandler.ExecutionHandlerAdaptor
-
- All Implemented Interfaces:
NHttpRequestExecutionHandler
- Enclosing class:
- BufferingHttpClientHandler
static class BufferingHttpClientHandler.ExecutionHandlerAdaptor extends java.lang.Object implements NHttpRequestExecutionHandler
-
-
Field Summary
Fields Modifier and Type Field Description private HttpRequestExecutionHandlerexecHandler
-
Constructor Summary
Constructors Constructor Description ExecutionHandlerAdaptor(HttpRequestExecutionHandler execHandler)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidfinalizeContext(HttpContext context)Triggered when the connection is terminated.voidhandleResponse(HttpResponse response, HttpContext context)Triggered when an HTTP response is ready to be processed.voidinitalizeContext(HttpContext context, java.lang.Object attachment)Triggered when a new connection has been established and the HTTP context needs to be initialized.ConsumingNHttpEntityresponseEntity(HttpResponse response, HttpContext context)Triggered when a response is received with an entity.HttpRequestsubmitRequest(HttpContext context)Triggered when the underlying connection is ready to send a new HTTP request to the target host.
-
-
-
Field Detail
-
execHandler
private final HttpRequestExecutionHandler execHandler
-
-
Constructor Detail
-
ExecutionHandlerAdaptor
public ExecutionHandlerAdaptor(HttpRequestExecutionHandler execHandler)
-
-
Method Detail
-
initalizeContext
public void initalizeContext(HttpContext context, java.lang.Object attachment)
Description copied from interface:NHttpRequestExecutionHandlerTriggered when a new connection has been established and the HTTP context needs to be initialized.The attachment object is the same object which was passed to the connecting I/O reactor when the connection request was made. The attachment may optionally contain some state information required in order to correctly initalize the HTTP context.
- Specified by:
initalizeContextin interfaceNHttpRequestExecutionHandler- Parameters:
context- the actual HTTP contextattachment- the object passed to the connecting I/O reactor upon the request for a new connection.- See Also:
ConnectingIOReactor.connect(java.net.SocketAddress, java.net.SocketAddress, java.lang.Object, org.apache.http.nio.reactor.SessionRequestCallback)
-
finalizeContext
public void finalizeContext(HttpContext context)
Description copied from interface:NHttpRequestExecutionHandlerTriggered when the connection is terminated. This event can be used to release objects stored in the context or perform some other kind of cleanup.- Specified by:
finalizeContextin interfaceNHttpRequestExecutionHandler- Parameters:
context- the actual HTTP context
-
submitRequest
public HttpRequest submitRequest(HttpContext context)
Description copied from interface:NHttpRequestExecutionHandlerTriggered when the underlying connection is ready to send a new HTTP request to the target host. This method may returnnullif the client is not yet ready to send a request. In this case the connection will remain open and can be activated at a later point.If the request has an entity, the entity must be an instance of
ProducingNHttpEntity.- Specified by:
submitRequestin interfaceNHttpRequestExecutionHandler- Parameters:
context- the actual HTTP context- Returns:
- an HTTP request to be sent or
nullif no request needs to be sent
-
responseEntity
public ConsumingNHttpEntity responseEntity(HttpResponse response, HttpContext context) throws java.io.IOException
Description copied from interface:NHttpRequestExecutionHandlerTriggered when a response is received with an entity. This method should return aConsumingNHttpEntitythat will be used to consume the entity.nullis a valid response value, and will indicate that the entity should be silently ignored.After the entity is fully consumed,
NHttpRequestExecutionHandler.handleResponse(HttpResponse, HttpContext)is called to notify a full response & entity are ready to be processed.- Specified by:
responseEntityin interfaceNHttpRequestExecutionHandler- Parameters:
response- The response containing the existing entity.context- the actual HTTP context- Returns:
- An entity that will asynchronously consume the response's content body.
- Throws:
java.io.IOException
-
handleResponse
public void handleResponse(HttpResponse response, HttpContext context) throws java.io.IOException
Description copied from interface:NHttpRequestExecutionHandlerTriggered when an HTTP response is ready to be processed.- Specified by:
handleResponsein interfaceNHttpRequestExecutionHandler- Parameters:
response- the HTTP response to be processedcontext- the actual HTTP context- Throws:
java.io.IOException
-
-