|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.http.nio.protocol.BasicAsyncRequestExecutionHandler<T>
T - the result type of request execution.public class BasicAsyncRequestExecutionHandler<T>
Basic implementation of HttpAsyncRequestExecutionHandler that executes
a single HTTP request / response exchange.
| Constructor Summary | |
|---|---|
BasicAsyncRequestExecutionHandler(HttpAsyncRequestProducer requestProducer,
HttpAsyncResponseConsumer<T> responseConsumer,
FutureCallback<T> callback,
HttpContext localContext,
HttpProcessor httppocessor,
ConnectionReuseStrategy reuseStrategy,
HttpParams params)
|
|
BasicAsyncRequestExecutionHandler(HttpAsyncRequestProducer requestProducer,
HttpAsyncResponseConsumer<T> responseConsumer,
HttpContext localContext,
HttpProcessor httppocessor,
ConnectionReuseStrategy reuseStrategy,
HttpParams params)
|
|
| Method Summary | |
|---|---|
boolean |
cancel()
|
void |
close()
|
void |
consumeContent(ContentDecoder decoder,
IOControl ioctrl)
Invoked to process a chunk of content from the ContentDecoder. |
void |
failed(Exception ex)
Invoked to signal that the response processing terminated abnormally. |
HttpRequest |
generateRequest()
Invoked to generate a HTTP request message head. |
ConnectionReuseStrategy |
getConnectionReuseStrategy()
Returns ConnectionReuseStrategy implementation to be used
to determine whether or not the underlying connection can be kept alive
after a particular HTTP request / response exchange. |
HttpContext |
getContext()
Returns shared HttpContext instance. |
Exception |
getException()
Returns an exception in case of an abnormal termination. |
Future<T> |
getFuture()
|
HttpProcessor |
getHttpProcessor()
Returns HttpProcessor implementation to be used to process
HTTP request and response messages for protocol compliance. |
T |
getResult()
Returns a result of the response processing, when available. |
HttpHost |
getTarget()
Invoked to obtain the request target host. |
boolean |
isDone()
Determines whether or not the response processing completed. |
boolean |
isRepeatable()
Determines whether or not this producer is capable of producing HTTP request messages more than once. |
void |
produceContent(ContentEncoder encoder,
IOControl ioctrl)
Invoked to write out a chunk of content to the ContentEncoder. |
void |
requestCompleted(HttpContext context)
Invoked to signal that the request has been fully written out. |
void |
resetRequest()
Invoked to reset the producer to its initial state. |
void |
responseCompleted(HttpContext context)
Invoked to signal that the response has been fully processed. |
void |
responseReceived(HttpResponse response)
Invoked when a HTTP response message is received. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public BasicAsyncRequestExecutionHandler(HttpAsyncRequestProducer requestProducer,
HttpAsyncResponseConsumer<T> responseConsumer,
FutureCallback<T> callback,
HttpContext localContext,
HttpProcessor httppocessor,
ConnectionReuseStrategy reuseStrategy,
HttpParams params)
public BasicAsyncRequestExecutionHandler(HttpAsyncRequestProducer requestProducer,
HttpAsyncResponseConsumer<T> responseConsumer,
HttpContext localContext,
HttpProcessor httppocessor,
ConnectionReuseStrategy reuseStrategy,
HttpParams params)
| Method Detail |
|---|
public Future<T> getFuture()
public void close()
throws IOException
close in interface CloseableIOExceptionpublic HttpHost getTarget()
HttpAsyncRequestProducer
getTarget in interface HttpAsyncRequestProducer
public HttpRequest generateRequest()
throws IOException,
HttpException
HttpAsyncRequestProducerHttpEntityEnclosingRequest interface if it is
to enclose a content entity. The HttpAsyncRequestProducer.produceContent(ContentEncoder, IOControl)
method will not be invoked if HttpEntityEnclosingRequest.getEntity()
returns null.
generateRequest in interface HttpAsyncRequestProducerIOException - in case of an I/O error
HttpException - in case of HTTP protocol violation
public void produceContent(ContentEncoder encoder,
IOControl ioctrl)
throws IOException
HttpAsyncRequestProducerContentEncoder.
The IOControl interface can be used to suspend output events
if the producer is temporarily unable to produce more content.
When all content is finished, the producer MUST call
ContentEncoder.complete(). Failure to do so may cause the entity
to be incorrectly delimited.
produceContent in interface HttpAsyncRequestProducerencoder - content encoder.ioctrl - I/O control of the underlying connection.
IOException - in case of an I/O errorpublic void requestCompleted(HttpContext context)
HttpAsyncRequestProducer
requestCompleted in interface HttpAsyncRequestProducercontext - HTTP contextpublic boolean isRepeatable()
HttpAsyncRequestProducer
isRepeatable in interface HttpAsyncRequestProducerpublic void resetRequest()
HttpAsyncRequestProducer
resetRequest in interface HttpAsyncRequestProducer
public void responseReceived(HttpResponse response)
throws IOException,
HttpException
HttpAsyncResponseConsumerHttpAsyncResponseConsumer.consumeContent(ContentDecoder, IOControl) method
will be invoked only if the response messages has a content entity
enclosed.
responseReceived in interface HttpAsyncResponseConsumer<T>response - HTTP response message.
IOException - in case of an I/O error
HttpException - in case of HTTP protocol violation
public void consumeContent(ContentDecoder decoder,
IOControl ioctrl)
throws IOException
HttpAsyncResponseConsumerContentDecoder.
The IOControl interface can be used to suspend input events
if the consumer is temporarily unable to consume more content.
The consumer can use the ContentDecoder.isCompleted() method
to find out whether or not the message content has been fully consumed.
consumeContent in interface HttpAsyncResponseConsumer<T>decoder - content decoder.ioctrl - I/O control of the underlying connection.
IOException - in case of an I/O errorpublic void failed(Exception ex)
HttpAsyncRequestProducer
failed in interface HttpAsyncRequestProducerfailed in interface HttpAsyncResponseConsumer<T>ex - exceptionpublic boolean cancel()
cancel in interface Cancellablepublic void responseCompleted(HttpContext context)
HttpAsyncResponseConsumer
responseCompleted in interface HttpAsyncResponseConsumer<T>context - HTTP contextpublic T getResult()
HttpAsyncResponseConsumernull if the response processing is still ongoing.
getResult in interface HttpAsyncResponseConsumer<T>HttpAsyncResponseConsumer.isDone()public Exception getException()
HttpAsyncResponseConsumernull if the response processing is still ongoing
or if it completed successfully.
getException in interface HttpAsyncResponseConsumer<T>HttpAsyncResponseConsumer.isDone()public HttpContext getContext()
HttpAsyncRequestExecutionHandlerHttpContext instance.
getContext in interface HttpAsyncRequestExecutionHandler<T>public HttpProcessor getHttpProcessor()
HttpAsyncRequestExecutionHandlerHttpProcessor implementation to be used to process
HTTP request and response messages for protocol compliance.
getHttpProcessor in interface HttpAsyncRequestExecutionHandler<T>public ConnectionReuseStrategy getConnectionReuseStrategy()
HttpAsyncRequestExecutionHandlerConnectionReuseStrategy implementation to be used
to determine whether or not the underlying connection can be kept alive
after a particular HTTP request / response exchange.
getConnectionReuseStrategy in interface HttpAsyncRequestExecutionHandler<T>public boolean isDone()
HttpAsyncResponseConsumerHttpAsyncResponseConsumer.getResult()
can be used to obtain the result. If the response processing terminated
abnormally HttpAsyncResponseConsumer.getException() can be used to obtain the cause.
isDone in interface HttpAsyncResponseConsumer<T>
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||