Class BasicAsyncRequestExecutionHandler<T>
- java.lang.Object
-
- org.apache.http.nio.protocol.BasicAsyncRequestExecutionHandler<T>
-
- Type Parameters:
T- the result type of request execution.
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable,Cancellable,HttpAsyncRequestExecutionHandler<T>,HttpAsyncRequestProducer,HttpAsyncResponseConsumer<T>
@Deprecated public class BasicAsyncRequestExecutionHandler<T> extends java.lang.Object implements HttpAsyncRequestExecutionHandler<T>
Deprecated.(4.3) useBasicAsyncClientExchangeHandler.Basic implementation ofHttpAsyncRequestExecutionHandlerthat executes a single HTTP request / response exchange.- Since:
- 4.2
-
-
Constructor Summary
Constructors Constructor Description BasicAsyncRequestExecutionHandler(HttpAsyncRequestProducer requestProducer, HttpAsyncResponseConsumer<T> responseConsumer, FutureCallback<T> callback, HttpContext localContext, HttpProcessor httppocessor, ConnectionReuseStrategy reuseStrategy, HttpParams params)Deprecated.BasicAsyncRequestExecutionHandler(HttpAsyncRequestProducer requestProducer, HttpAsyncResponseConsumer<T> responseConsumer, HttpContext localContext, HttpProcessor httppocessor, ConnectionReuseStrategy reuseStrategy, HttpParams params)Deprecated.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description booleancancel()Deprecated.voidclose()Deprecated.voidconsumeContent(ContentDecoder decoder, IOControl ioctrl)Deprecated.Invoked to process a chunk of content from theContentDecoder.voidfailed(java.lang.Exception ex)Deprecated.Invoked to signal that the response processing terminated abnormally.HttpRequestgenerateRequest()Deprecated.Invoked to generate a HTTP request message head.ConnectionReuseStrategygetConnectionReuseStrategy()Deprecated.ReturnsConnectionReuseStrategyimplementation to be used to determine whether or not the underlying connection can be kept alive after a particular HTTP request / response exchange.HttpContextgetContext()Deprecated.Returns sharedHttpContextinstance.java.lang.ExceptiongetException()Deprecated.Returns an exception in case of an abnormal termination.java.util.concurrent.Future<T>getFuture()Deprecated.HttpProcessorgetHttpProcessor()Deprecated.ReturnsHttpProcessorimplementation to be used to process HTTP request and response messages for protocol compliance.TgetResult()Deprecated.Returns a result of the response processing, when available.HttpHostgetTarget()Deprecated.Invoked to obtain the request target host.booleanisDone()Deprecated.Determines whether or not the response processing completed.booleanisRepeatable()Deprecated.Determines whether or not this producer is capable of producing HTTP request messages more than once.voidproduceContent(ContentEncoder encoder, IOControl ioctrl)Deprecated.Invoked to write out a chunk of content to theContentEncoder.voidrequestCompleted(HttpContext context)Deprecated.Invoked to signal that the request has been fully written out.voidresetRequest()Deprecated.Invoked to reset the producer to its initial state.voidresponseCompleted(HttpContext context)Deprecated.Invoked to signal that the response has been fully processed.voidresponseReceived(HttpResponse response)Deprecated.Invoked when a HTTP response message is received.
-
-
-
Constructor Detail
-
BasicAsyncRequestExecutionHandler
public BasicAsyncRequestExecutionHandler(HttpAsyncRequestProducer requestProducer, HttpAsyncResponseConsumer<T> responseConsumer, FutureCallback<T> callback, HttpContext localContext, HttpProcessor httppocessor, ConnectionReuseStrategy reuseStrategy, HttpParams params)
Deprecated.
-
BasicAsyncRequestExecutionHandler
public BasicAsyncRequestExecutionHandler(HttpAsyncRequestProducer requestProducer, HttpAsyncResponseConsumer<T> responseConsumer, HttpContext localContext, HttpProcessor httppocessor, ConnectionReuseStrategy reuseStrategy, HttpParams params)
Deprecated.
-
-
Method Detail
-
getFuture
public java.util.concurrent.Future<T> getFuture()
Deprecated.
-
close
public void close() throws java.io.IOExceptionDeprecated.- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Throws:
java.io.IOException
-
getTarget
public HttpHost getTarget()
Deprecated.Description copied from interface:HttpAsyncRequestProducerInvoked to obtain the request target host.- Specified by:
getTargetin interfaceHttpAsyncRequestProducer
-
generateRequest
public HttpRequest generateRequest() throws java.io.IOException, HttpException
Deprecated.Description copied from interface:HttpAsyncRequestProducerInvoked to generate a HTTP request message head. The message is expected to implement theHttpEntityEnclosingRequestinterface if it is to enclose a content entity. TheHttpAsyncRequestProducer.produceContent( ContentEncoder, IOControl)method will not be invoked ifHttpEntityEnclosingRequest.getEntity()returnsnull.- Specified by:
generateRequestin interfaceHttpAsyncRequestProducer- Returns:
- HTTP request message.
- Throws:
java.io.IOException- in case of an I/O errorHttpException- in case of HTTP protocol violation
-
produceContent
public void produceContent(ContentEncoder encoder, IOControl ioctrl) throws java.io.IOException
Deprecated.Description copied from interface:HttpAsyncRequestProducerInvoked to write out a chunk of content to theContentEncoder. TheIOControlinterface can be used to suspend output event notifications 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.Please note that the
ContentEncoderobject is not thread-safe and should only be used within the context of this method call. TheIOControlobject can be shared and used on other thread to resume output event notifications when more content is made available.- Specified by:
produceContentin interfaceHttpAsyncRequestProducer- Parameters:
encoder- content encoder.ioctrl- I/O control of the underlying connection.- Throws:
java.io.IOException- in case of an I/O error
-
requestCompleted
public void requestCompleted(HttpContext context)
Deprecated.Description copied from interface:HttpAsyncRequestProducerInvoked to signal that the request has been fully written out.- Specified by:
requestCompletedin interfaceHttpAsyncRequestProducer- Parameters:
context- HTTP context
-
isRepeatable
public boolean isRepeatable()
Deprecated.Description copied from interface:HttpAsyncRequestProducerDetermines whether or not this producer is capable of producing HTTP request messages more than once.- Specified by:
isRepeatablein interfaceHttpAsyncRequestProducer
-
resetRequest
public void resetRequest()
Deprecated.Description copied from interface:HttpAsyncRequestProducerInvoked to reset the producer to its initial state. Repeatable request producers are expected to release currently allocated resources that are no longer needed or re-acquire resources needed to repeat the process.- Specified by:
resetRequestin interfaceHttpAsyncRequestProducer
-
responseReceived
public void responseReceived(HttpResponse response) throws java.io.IOException, HttpException
Deprecated.Description copied from interface:HttpAsyncResponseConsumerInvoked when a HTTP response message is received. Please note that theHttpAsyncResponseConsumer.consumeContent(ContentDecoder, IOControl)method will be invoked only if the response messages has a content entity enclosed.- Specified by:
responseReceivedin interfaceHttpAsyncResponseConsumer<T>- Parameters:
response- HTTP response message.- Throws:
java.io.IOException- in case of an I/O errorHttpException- in case of HTTP protocol violation
-
consumeContent
public void consumeContent(ContentDecoder decoder, IOControl ioctrl) throws java.io.IOException
Deprecated.Description copied from interface:HttpAsyncResponseConsumerInvoked to process a chunk of content from theContentDecoder. TheIOControlinterface can be used to suspend input event notifications if the consumer is temporarily unable to process content.The consumer can use the
ContentDecoder.isCompleted()method to find out whether or not the message content has been fully consumed.Please note that the
ContentDecoderobject is not thread-safe and should only be used within the context of this method call. TheIOControlobject can be shared and used on other thread to resume input event notifications when the consumer is capable of processing more content.- Specified by:
consumeContentin interfaceHttpAsyncResponseConsumer<T>- Parameters:
decoder- content decoder.ioctrl- I/O control of the underlying connection.- Throws:
java.io.IOException- in case of an I/O error
-
failed
public void failed(java.lang.Exception ex)
Deprecated.Description copied from interface:HttpAsyncRequestProducerInvoked to signal that the response processing terminated abnormally.- Specified by:
failedin interfaceHttpAsyncRequestProducer- Specified by:
failedin interfaceHttpAsyncResponseConsumer<T>- Parameters:
ex- exception
-
cancel
public boolean cancel()
Deprecated.- Specified by:
cancelin interfaceCancellable
-
responseCompleted
public void responseCompleted(HttpContext context)
Deprecated.Description copied from interface:HttpAsyncResponseConsumerInvoked to signal that the response has been fully processed.- Specified by:
responseCompletedin interfaceHttpAsyncResponseConsumer<T>- Parameters:
context- HTTP context
-
getResult
public T getResult()
Deprecated.Description copied from interface:HttpAsyncResponseConsumerReturns a result of the response processing, when available. This method returnsnullif the response processing is still ongoing.- Specified by:
getResultin interfaceHttpAsyncResponseConsumer<T>- See Also:
HttpAsyncResponseConsumer.isDone()
-
getException
public java.lang.Exception getException()
Deprecated.Description copied from interface:HttpAsyncResponseConsumerReturns an exception in case of an abnormal termination. This method returnsnullif the response processing is still ongoing or if it completed successfully.- Specified by:
getExceptionin interfaceHttpAsyncResponseConsumer<T>- See Also:
HttpAsyncResponseConsumer.isDone()
-
getContext
public HttpContext getContext()
Deprecated.Description copied from interface:HttpAsyncRequestExecutionHandlerReturns sharedHttpContextinstance.- Specified by:
getContextin interfaceHttpAsyncRequestExecutionHandler<T>- Returns:
- HTTP context
-
getHttpProcessor
public HttpProcessor getHttpProcessor()
Deprecated.Description copied from interface:HttpAsyncRequestExecutionHandlerReturnsHttpProcessorimplementation to be used to process HTTP request and response messages for protocol compliance.- Specified by:
getHttpProcessorin interfaceHttpAsyncRequestExecutionHandler<T>- Returns:
- HTTP protocol processor.
-
getConnectionReuseStrategy
public ConnectionReuseStrategy getConnectionReuseStrategy()
Deprecated.Description copied from interface:HttpAsyncRequestExecutionHandlerReturnsConnectionReuseStrategyimplementation to be used to determine whether or not the underlying connection can be kept alive after a particular HTTP request / response exchange.- Specified by:
getConnectionReuseStrategyin interfaceHttpAsyncRequestExecutionHandler<T>- Returns:
- connection re-use strategy.
-
isDone
public boolean isDone()
Deprecated.Description copied from interface:HttpAsyncResponseConsumerDetermines whether or not the response processing completed. If the response processing terminated normallyHttpAsyncResponseConsumer.getResult()can be used to obtain the result. If the response processing terminated abnormallyHttpAsyncResponseConsumer.getException()can be used to obtain the cause.- Specified by:
isDonein interfaceHttpAsyncResponseConsumer<T>
-
-