Package org.apache.http.impl.nio.client
Class DefaultClientExchangeHandlerImpl<T>
- java.lang.Object
-
- org.apache.http.impl.nio.client.AbstractClientExchangeHandler
-
- org.apache.http.impl.nio.client.DefaultClientExchangeHandlerImpl<T>
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
,org.apache.http.concurrent.Cancellable
,org.apache.http.nio.protocol.HttpAsyncClientExchangeHandler
class DefaultClientExchangeHandlerImpl<T> extends AbstractClientExchangeHandler
Default implementation ofHttpAsyncClientExchangeHandler
.Instances of this class are expected to be accessed by one thread at a time only. The
AbstractClientExchangeHandler.cancel()
method can be called concurrently by multiple threads.
-
-
Field Summary
Fields Modifier and Type Field Description private InternalClientExec
exec
private org.apache.http.nio.protocol.HttpAsyncRequestProducer
requestProducer
private org.apache.http.nio.protocol.HttpAsyncResponseConsumer<T>
responseConsumer
private org.apache.http.concurrent.BasicFuture<T>
resultFuture
private InternalState
state
-
Fields inherited from class org.apache.http.impl.nio.client.AbstractClientExchangeHandler
log
-
-
Constructor Summary
Constructors Constructor Description DefaultClientExchangeHandlerImpl(org.apache.commons.logging.Log log, org.apache.http.nio.protocol.HttpAsyncRequestProducer requestProducer, org.apache.http.nio.protocol.HttpAsyncResponseConsumer<T> responseConsumer, org.apache.http.client.protocol.HttpClientContext localContext, org.apache.http.concurrent.BasicFuture<T> resultFuture, NHttpClientConnectionManager connmgr, org.apache.http.ConnectionReuseStrategy connReuseStrategy, org.apache.http.conn.ConnectionKeepAliveStrategy keepaliveStrategy, InternalClientExec exec)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
abortConnection()
void
consumeContent(org.apache.http.nio.ContentDecoder decoder, org.apache.http.nio.IOControl ioctrl)
(package private) boolean
executionCancelled()
(package private) void
executionFailed(java.lang.Exception ex)
org.apache.http.HttpRequest
generateRequest()
void
inputTerminated()
void
produceContent(org.apache.http.nio.ContentEncoder encoder, org.apache.http.nio.IOControl ioctrl)
(package private) void
releaseResources()
void
requestCompleted()
void
responseCompleted()
void
responseReceived(org.apache.http.HttpResponse response)
void
start()
-
Methods inherited from class org.apache.http.impl.nio.client.AbstractClientExchangeHandler
cancel, close, discardConnection, failed, getActualRoute, getConnection, getCurrentRequest, getCurrentResponse, getId, getRoute, isCompleted, isDone, isRouteEstablished, manageConnectionPersistence, markCompleted, markConnectionNonReusable, onRouteComplete, onRouteToProxy, onRouteToTarget, onRouteTunnelToTarget, onRouteUpgrade, releaseConnection, requestConnection, setCurrentRequest, setCurrentResponse, setRoute, verifytRoute
-
-
-
-
Field Detail
-
requestProducer
private final org.apache.http.nio.protocol.HttpAsyncRequestProducer requestProducer
-
responseConsumer
private final org.apache.http.nio.protocol.HttpAsyncResponseConsumer<T> responseConsumer
-
resultFuture
private final org.apache.http.concurrent.BasicFuture<T> resultFuture
-
exec
private final InternalClientExec exec
-
state
private final InternalState state
-
-
Constructor Detail
-
DefaultClientExchangeHandlerImpl
public DefaultClientExchangeHandlerImpl(org.apache.commons.logging.Log log, org.apache.http.nio.protocol.HttpAsyncRequestProducer requestProducer, org.apache.http.nio.protocol.HttpAsyncResponseConsumer<T> responseConsumer, org.apache.http.client.protocol.HttpClientContext localContext, org.apache.http.concurrent.BasicFuture<T> resultFuture, NHttpClientConnectionManager connmgr, org.apache.http.ConnectionReuseStrategy connReuseStrategy, org.apache.http.conn.ConnectionKeepAliveStrategy keepaliveStrategy, InternalClientExec exec)
-
-
Method Detail
-
releaseResources
void releaseResources()
- Specified by:
releaseResources
in classAbstractClientExchangeHandler
-
executionFailed
void executionFailed(java.lang.Exception ex)
- Specified by:
executionFailed
in classAbstractClientExchangeHandler
-
executionCancelled
boolean executionCancelled()
- Specified by:
executionCancelled
in classAbstractClientExchangeHandler
-
start
public void start() throws org.apache.http.HttpException, java.io.IOException
- Throws:
org.apache.http.HttpException
java.io.IOException
-
generateRequest
public org.apache.http.HttpRequest generateRequest() throws java.io.IOException, org.apache.http.HttpException
- Throws:
java.io.IOException
org.apache.http.HttpException
-
produceContent
public void produceContent(org.apache.http.nio.ContentEncoder encoder, org.apache.http.nio.IOControl ioctrl) throws java.io.IOException
- Throws:
java.io.IOException
-
requestCompleted
public void requestCompleted()
-
responseReceived
public void responseReceived(org.apache.http.HttpResponse response) throws java.io.IOException, org.apache.http.HttpException
- Throws:
java.io.IOException
org.apache.http.HttpException
-
consumeContent
public void consumeContent(org.apache.http.nio.ContentDecoder decoder, org.apache.http.nio.IOControl ioctrl) throws java.io.IOException
- Throws:
java.io.IOException
-
responseCompleted
public void responseCompleted() throws java.io.IOException, org.apache.http.HttpException
- Throws:
java.io.IOException
org.apache.http.HttpException
-
inputTerminated
public void inputTerminated()
-
abortConnection
public void abortConnection()
-
-