|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.http.nio.protocol.PipeliningClientExchangeHandler<T>
T - the result type of request execution.@Pipelined public class PipeliningClientExchangeHandler<T>
Pipelining implementation of HttpAsyncClientExchangeHandler
that executes a series of pipelined HTTP requests.
| Constructor Summary | |
|---|---|
PipeliningClientExchangeHandler(List<? extends HttpAsyncRequestProducer> requestProducers,
List<? extends HttpAsyncResponseConsumer<T>> responseConsumers,
FutureCallback<List<T>> callback,
HttpContext localContext,
NHttpClientConnection conn,
HttpProcessor httppocessor,
ConnectionReuseStrategy connReuseStrategy)
Creates new instance of PipeliningClientExchangeHandler. |
|
PipeliningClientExchangeHandler(List<? extends HttpAsyncRequestProducer> requestProducers,
List<? extends HttpAsyncResponseConsumer<T>> responseConsumers,
HttpContext localContext,
NHttpClientConnection conn,
HttpProcessor httppocessor)
Creates new instance of PipeliningClientExchangeHandler. |
|
| 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. |
Future<List<T>> |
getFuture()
|
void |
inputTerminated()
Invoked to signal that the connection has been terminated prematurely by the opposite end. |
boolean |
isDone()
Determines whether or not the response processing completed. |
void |
produceContent(ContentEncoder encoder,
IOControl ioctrl)
Invoked to write out a chunk of content to the ContentEncoder. |
void |
requestCompleted()
Invoked to signal that the request has been fully written out. |
void |
responseCompleted()
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 PipeliningClientExchangeHandler(List<? extends HttpAsyncRequestProducer> requestProducers,
List<? extends HttpAsyncResponseConsumer<T>> responseConsumers,
FutureCallback<List<T>> callback,
HttpContext localContext,
NHttpClientConnection conn,
HttpProcessor httppocessor,
ConnectionReuseStrategy connReuseStrategy)
PipeliningClientExchangeHandler.
requestProducers - the request producers.responseConsumers - the response consumers.callback - the future callback invoked when the operation is completed.localContext - the local execution context.conn - the actual connection.httppocessor - the HTTP protocol processor.connReuseStrategy - the connection re-use strategy.
public PipeliningClientExchangeHandler(List<? extends HttpAsyncRequestProducer> requestProducers,
List<? extends HttpAsyncResponseConsumer<T>> responseConsumers,
HttpContext localContext,
NHttpClientConnection conn,
HttpProcessor httppocessor)
PipeliningClientExchangeHandler.
requestProducers - the request producers.responseConsumers - the response consumers.localContext - the local execution context.conn - the actual connection.httppocessor - the HTTP protocol processor.| Method Detail |
|---|
public Future<List<T>> getFuture()
public void close()
throws IOException
close in interface CloseableIOException
public HttpRequest generateRequest()
throws IOException,
HttpException
HttpAsyncClientExchangeHandlerHttpEntityEnclosingRequest interface if it is
to enclose a content entity. The HttpAsyncClientExchangeHandler.produceContent(ContentEncoder,
IOControl) method will not be invoked if
HttpEntityEnclosingRequest.getEntity() returns
null.
generateRequest in interface HttpAsyncClientExchangeHandlerIOException - in case of an I/O error
HttpException - in case of HTTP protocol violation
public void produceContent(ContentEncoder encoder,
IOControl ioctrl)
throws IOException
HttpAsyncClientExchangeHandlerContentEncoder.
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.
produceContent in interface HttpAsyncClientExchangeHandlerencoder - content encoder.ioctrl - I/O control of the underlying connection.
IOException - in case of an I/O errorpublic void requestCompleted()
HttpAsyncClientExchangeHandler
requestCompleted in interface HttpAsyncClientExchangeHandler
public void responseReceived(HttpResponse response)
throws IOException,
HttpException
HttpAsyncClientExchangeHandlerHttpAsyncClientExchangeHandler.consumeContent(ContentDecoder, IOControl) method
will be invoked only if the response messages has a content entity
enclosed.
responseReceived in interface HttpAsyncClientExchangeHandlerresponse - 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
HttpAsyncClientExchangeHandlerContentDecoder.
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.
consumeContent in interface HttpAsyncClientExchangeHandlerdecoder - content decoder.ioctrl - I/O control of the underlying connection.
IOException - in case of an I/O error
public void responseCompleted()
throws IOException
HttpAsyncClientExchangeHandler
responseCompleted in interface HttpAsyncClientExchangeHandlerIOExceptionpublic void inputTerminated()
HttpAsyncClientExchangeHandler
inputTerminated in interface HttpAsyncClientExchangeHandlerpublic void failed(Exception ex)
HttpAsyncClientExchangeHandler
failed in interface HttpAsyncClientExchangeHandlerex - exceptionpublic boolean cancel()
cancel in interface Cancellablepublic boolean isDone()
HttpAsyncClientExchangeHandler
isDone in interface HttpAsyncClientExchangeHandler
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||