org.apache.http.nio.protocol
Class BasicAsyncRequestExecutionHandler<T>

java.lang.Object
  extended by org.apache.http.nio.protocol.BasicAsyncRequestExecutionHandler<T>
Type Parameters:
T - the result type of request execution.
All Implemented Interfaces:
Closeable, Cancellable, HttpAsyncRequestExecutionHandler<T>, HttpAsyncRequestProducer, HttpAsyncResponseConsumer<T>

Deprecated. (4.3) use BasicAsyncClientExchangeHandler.

@Deprecated
public class BasicAsyncRequestExecutionHandler<T>
extends Object
implements HttpAsyncRequestExecutionHandler<T>

Basic implementation of HttpAsyncRequestExecutionHandler that executes a single HTTP request / response exchange.

Since:
4.2

Constructor Summary
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
 boolean cancel()
          Deprecated.  
 void close()
          Deprecated.  
 void consumeContent(ContentDecoder decoder, IOControl ioctrl)
          Deprecated. Invoked to process a chunk of content from the ContentDecoder.
 void failed(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. 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()
          Deprecated. Returns shared HttpContext instance.
 Exception getException()
          Deprecated. Returns an exception in case of an abnormal termination.
 Future<T> getFuture()
          Deprecated.  
 HttpProcessor getHttpProcessor()
          Deprecated. Returns HttpProcessor 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 the ContentEncoder.
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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 Future<T> getFuture()
Deprecated. 

close

public void close()
           throws IOException
Deprecated. 
Specified by:
close in interface Closeable
Throws:
IOException

getTarget

public HttpHost getTarget()
Deprecated. 
Description copied from interface: HttpAsyncRequestProducer
Invoked to obtain the request target host.

Specified by:
getTarget in interface HttpAsyncRequestProducer

generateRequest

public HttpRequest generateRequest()
                            throws IOException,
                                   HttpException
Deprecated. 
Description copied from interface: HttpAsyncRequestProducer
Invoked to generate a HTTP request message head. The message is expected to implement the HttpEntityEnclosingRequest interface if it is to enclose a content entity. The HttpAsyncRequestProducer.produceContent( ContentEncoder, IOControl) method will not be invoked if HttpEntityEnclosingRequest.getEntity() returns null.

Specified by:
generateRequest in interface HttpAsyncRequestProducer
Returns:
HTTP request message.
Throws:
IOException - in case of an I/O error
HttpException - in case of HTTP protocol violation

produceContent

public void produceContent(ContentEncoder encoder,
                           IOControl ioctrl)
                    throws IOException
Deprecated. 
Description copied from interface: HttpAsyncRequestProducer
Invoked to write out a chunk of content to the ContentEncoder. The IOControl 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. The IOControl object can be shared and used on other thread to resume output event notifications when more content is made available.

Specified by:
produceContent in interface HttpAsyncRequestProducer
Parameters:
encoder - content encoder.
ioctrl - I/O control of the underlying connection.
Throws:
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 interface HttpAsyncRequestProducer
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 interface HttpAsyncRequestProducer

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 interface HttpAsyncRequestProducer

responseReceived

public void responseReceived(HttpResponse response)
                      throws IOException,
                             HttpException
Deprecated. 
Description copied from interface: HttpAsyncResponseConsumer
Invoked when a HTTP response message is received. Please note that the HttpAsyncResponseConsumer.consumeContent(ContentDecoder, IOControl) method will be invoked only if the response messages has a content entity enclosed.

Specified by:
responseReceived in interface HttpAsyncResponseConsumer<T>
Parameters:
response - HTTP response message.
Throws:
IOException - in case of an I/O error
HttpException - in case of HTTP protocol violation

consumeContent

public void consumeContent(ContentDecoder decoder,
                           IOControl ioctrl)
                    throws IOException
Deprecated. 
Description copied from interface: HttpAsyncResponseConsumer
Invoked to process a chunk of content from the ContentDecoder. The IOControl 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. The IOControl 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 interface HttpAsyncResponseConsumer<T>
Parameters:
decoder - content decoder.
ioctrl - I/O control of the underlying connection.
Throws:
IOException - in case of an I/O error

failed

public void failed(Exception ex)
Deprecated. 
Description copied from interface: HttpAsyncRequestProducer
Invoked to signal that the response processing terminated abnormally.

Specified by:
failed in interface HttpAsyncRequestProducer
Specified by:
failed in interface HttpAsyncResponseConsumer<T>
Parameters:
ex - exception

cancel

public boolean cancel()
Deprecated. 
Specified by:
cancel in interface Cancellable

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 interface HttpAsyncResponseConsumer<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 returns null if the response processing is still ongoing.

Specified by:
getResult in interface HttpAsyncResponseConsumer<T>
See Also:
HttpAsyncResponseConsumer.isDone()

getException

public Exception getException()
Deprecated. 
Description copied from interface: HttpAsyncResponseConsumer
Returns an exception in case of an abnormal termination. This method returns null if the response processing is still ongoing or if it completed successfully.

Specified by:
getException in interface HttpAsyncResponseConsumer<T>
See Also:
HttpAsyncResponseConsumer.isDone()

getContext

public HttpContext getContext()
Deprecated. 
Description copied from interface: HttpAsyncRequestExecutionHandler
Returns shared HttpContext instance.

Specified by:
getContext in interface HttpAsyncRequestExecutionHandler<T>
Returns:
HTTP context

getHttpProcessor

public HttpProcessor getHttpProcessor()
Deprecated. 
Description copied from interface: HttpAsyncRequestExecutionHandler
Returns HttpProcessor implementation to be used to process HTTP request and response messages for protocol compliance.

Specified by:
getHttpProcessor in interface HttpAsyncRequestExecutionHandler<T>
Returns:
HTTP protocol processor.

getConnectionReuseStrategy

public ConnectionReuseStrategy getConnectionReuseStrategy()
Deprecated. 
Description copied from interface: HttpAsyncRequestExecutionHandler
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.

Specified by:
getConnectionReuseStrategy in interface HttpAsyncRequestExecutionHandler<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 normally HttpAsyncResponseConsumer.getResult() can be used to obtain the result. If the response processing terminated abnormally HttpAsyncResponseConsumer.getException() can be used to obtain the cause.

Specified by:
isDone in interface HttpAsyncResponseConsumer<T>


Copyright © 2005–2015 The Apache Software Foundation. All rights reserved.