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 ofHttpAsyncRequestExecutionHandler
that 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 boolean
cancel()
Deprecated.void
close()
Deprecated.void
consumeContent(ContentDecoder decoder, IOControl ioctrl)
Deprecated.Invoked to process a chunk of content from theContentDecoder
.void
failed(java.lang.Exception ex)
Deprecated.Invoked to signal that the response processing terminated abnormally.HttpRequest
generateRequest()
Deprecated.Invoked to generate a HTTP request message head.ConnectionReuseStrategy
getConnectionReuseStrategy()
Deprecated.ReturnsConnectionReuseStrategy
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()
Deprecated.Returns sharedHttpContext
instance.java.lang.Exception
getException()
Deprecated.Returns an exception in case of an abnormal termination.java.util.concurrent.Future<T>
getFuture()
Deprecated.HttpProcessor
getHttpProcessor()
Deprecated.ReturnsHttpProcessor
implementation to be used to process HTTP request and response messages for protocol compliance.T
getResult()
Deprecated.Returns a result of the response processing, when available.HttpHost
getTarget()
Deprecated.Invoked to obtain the request target host.boolean
isDone()
Deprecated.Determines whether or not the response processing completed.boolean
isRepeatable()
Deprecated.Determines whether or not this producer is capable of producing HTTP request messages more than once.void
produceContent(ContentEncoder encoder, IOControl ioctrl)
Deprecated.Invoked to write out a chunk of content to theContentEncoder
.void
requestCompleted(HttpContext context)
Deprecated.Invoked to signal that the request has been fully written out.void
resetRequest()
Deprecated.Invoked to reset the producer to its initial state.void
responseCompleted(HttpContext context)
Deprecated.Invoked to signal that the response has been fully processed.void
responseReceived(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.IOException
Deprecated.- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Throws:
java.io.IOException
-
getTarget
public HttpHost getTarget()
Deprecated.Description copied from interface:HttpAsyncRequestProducer
Invoked to obtain the request target host.- Specified by:
getTarget
in interfaceHttpAsyncRequestProducer
-
generateRequest
public HttpRequest generateRequest() throws java.io.IOException, HttpException
Deprecated.Description copied from interface:HttpAsyncRequestProducer
Invoked to generate a HTTP request message head. The message is expected to implement theHttpEntityEnclosingRequest
interface if it is to enclose a content entity. TheHttpAsyncRequestProducer.produceContent( ContentEncoder, IOControl)
method will not be invoked ifHttpEntityEnclosingRequest.getEntity()
returnsnull
.- Specified by:
generateRequest
in 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:HttpAsyncRequestProducer
Invoked to write out a chunk of content to theContentEncoder
. TheIOControl
interface 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
ContentEncoder
object is not thread-safe and should only be used within the context of this method call. TheIOControl
object can be shared and used on other thread to resume output event notifications when more content is made available.- Specified by:
produceContent
in 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:HttpAsyncRequestProducer
Invoked to signal that the request has been fully written out.- Specified by:
requestCompleted
in interfaceHttpAsyncRequestProducer
- Parameters:
context
- HTTP context
-
isRepeatable
public boolean isRepeatable()
Deprecated.Description copied from interface:HttpAsyncRequestProducer
Determines whether or not this producer is capable of producing HTTP request messages more than once.- Specified by:
isRepeatable
in interfaceHttpAsyncRequestProducer
-
resetRequest
public void resetRequest()
Deprecated.Description copied from interface:HttpAsyncRequestProducer
Invoked 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:
resetRequest
in interfaceHttpAsyncRequestProducer
-
responseReceived
public void responseReceived(HttpResponse response) throws java.io.IOException, HttpException
Deprecated.Description copied from interface:HttpAsyncResponseConsumer
Invoked 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:
responseReceived
in 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:HttpAsyncResponseConsumer
Invoked to process a chunk of content from theContentDecoder
. TheIOControl
interface 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
ContentDecoder
object is not thread-safe and should only be used within the context of this method call. TheIOControl
object can be shared and used on other thread to resume input event notifications when the consumer is capable of processing more content.- Specified by:
consumeContent
in 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:HttpAsyncRequestProducer
Invoked to signal that the response processing terminated abnormally.- Specified by:
failed
in interfaceHttpAsyncRequestProducer
- Specified by:
failed
in interfaceHttpAsyncResponseConsumer<T>
- Parameters:
ex
- exception
-
cancel
public boolean cancel()
Deprecated.- Specified by:
cancel
in interfaceCancellable
-
responseCompleted
public void responseCompleted(HttpContext context)
Deprecated.Description copied from interface:HttpAsyncResponseConsumer
Invoked to signal that the response has been fully processed.- Specified by:
responseCompleted
in interfaceHttpAsyncResponseConsumer<T>
- Parameters:
context
- HTTP context
-
getResult
public T getResult()
Deprecated.Description copied from interface:HttpAsyncResponseConsumer
Returns a result of the response processing, when available. This method returnsnull
if the response processing is still ongoing.- Specified by:
getResult
in interfaceHttpAsyncResponseConsumer<T>
- See Also:
HttpAsyncResponseConsumer.isDone()
-
getException
public java.lang.Exception getException()
Deprecated.Description copied from interface:HttpAsyncResponseConsumer
Returns an exception in case of an abnormal termination. This method returnsnull
if the response processing is still ongoing or if it completed successfully.- Specified by:
getException
in interfaceHttpAsyncResponseConsumer<T>
- See Also:
HttpAsyncResponseConsumer.isDone()
-
getContext
public HttpContext getContext()
Deprecated.Description copied from interface:HttpAsyncRequestExecutionHandler
Returns sharedHttpContext
instance.- Specified by:
getContext
in interfaceHttpAsyncRequestExecutionHandler<T>
- Returns:
- HTTP context
-
getHttpProcessor
public HttpProcessor getHttpProcessor()
Deprecated.Description copied from interface:HttpAsyncRequestExecutionHandler
ReturnsHttpProcessor
implementation to be used to process HTTP request and response messages for protocol compliance.- Specified by:
getHttpProcessor
in interfaceHttpAsyncRequestExecutionHandler<T>
- Returns:
- HTTP protocol processor.
-
getConnectionReuseStrategy
public ConnectionReuseStrategy getConnectionReuseStrategy()
Deprecated.Description copied from interface:HttpAsyncRequestExecutionHandler
ReturnsConnectionReuseStrategy
implementation to be used to determine whether or not the underlying connection can be kept alive after a particular HTTP request / response exchange.- Specified by:
getConnectionReuseStrategy
in interfaceHttpAsyncRequestExecutionHandler<T>
- Returns:
- connection re-use strategy.
-
isDone
public boolean isDone()
Deprecated.Description copied from interface:HttpAsyncResponseConsumer
Determines 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:
isDone
in interfaceHttpAsyncResponseConsumer<T>
-
-