public class ClientHandler extends Object implements org.apache.http.nio.NHttpClientEventHandler
Modifier and Type | Field and Description |
---|---|
static String |
AXIS2_HTTP_REQUEST |
static String |
CLIENT_CONNECTION_DEBUG |
static String |
CONNECTION_CREATION_TIME |
static String |
OUTGOING_MESSAGE_CONTEXT |
static String |
REQUEST_SOURCE_BUFFER |
static String |
RESPONSE_SINK_BUFFER |
Constructor and Description |
---|
ClientHandler(org.apache.axis2.context.ConfigurationContext cfgCtx,
NhttpMetricsCollector metrics)
Create an instance of this client connection handler using the Axis2 configuration
context and Http protocol parameters given
|
Modifier and Type | Method and Description |
---|---|
void |
closed(org.apache.http.nio.NHttpClientConnection conn)
Handle connection close events
|
void |
connected(org.apache.http.nio.NHttpClientConnection conn,
Object attachment)
Invoked when the destination is connected
|
void |
endOfInput(org.apache.http.nio.NHttpClientConnection conn) |
void |
exception(org.apache.http.nio.NHttpClientConnection conn,
Exception e) |
void |
exception(org.apache.http.nio.NHttpClientConnection conn,
org.apache.http.HttpException e)
Handle Http protocol violations encountered while reading from underlying channels
|
void |
exception(org.apache.http.nio.NHttpClientConnection conn,
IOException e)
Handle IO errors while reading or writing to underlying channels
|
void |
execute(Runnable task) |
int |
getActiveCount() |
int |
getQueueSize() |
void |
inputReady(org.apache.http.nio.NHttpClientConnection conn,
org.apache.http.nio.ContentDecoder decoder)
Process ready input (i.e.
|
protected void |
markRequestCompletedWithError(Axis2HttpRequest axis2Request,
int errorCode,
String errorMessage,
Exception exceptionToRaise)
Mark request to send failed with error
|
void |
outputReady(org.apache.http.nio.NHttpClientConnection conn,
org.apache.http.nio.ContentEncoder encoder)
Process ready output (i.e.
|
void |
requestReady(org.apache.http.nio.NHttpClientConnection conn) |
void |
responseReceived(org.apache.http.nio.NHttpClientConnection conn)
Process a response received for the request sent out
|
void |
stop() |
void |
submitRequest(org.apache.http.nio.NHttpClientConnection conn,
Axis2HttpRequest axis2Req)
Submit a new request over an already established connection, which has been
'kept alive'
|
void |
timeout(org.apache.http.nio.NHttpClientConnection conn)
Handle connection timeouts by shutting down the connections.
|
public static final String OUTGOING_MESSAGE_CONTEXT
public static final String AXIS2_HTTP_REQUEST
public static final String CLIENT_CONNECTION_DEBUG
public static final String CONNECTION_CREATION_TIME
public static final String REQUEST_SOURCE_BUFFER
public static final String RESPONSE_SINK_BUFFER
public ClientHandler(org.apache.axis2.context.ConfigurationContext cfgCtx, NhttpMetricsCollector metrics)
cfgCtx
- the Axis2 configuration contextmetrics
- statistics collection metricspublic void requestReady(org.apache.http.nio.NHttpClientConnection conn)
requestReady
in interface org.apache.http.nio.NHttpClientEventHandler
public void submitRequest(org.apache.http.nio.NHttpClientConnection conn, Axis2HttpRequest axis2Req) throws org.apache.http.ConnectionClosedException
conn
- the connection to use to send the request, which has been kept openaxis2Req
- the new requestorg.apache.http.ConnectionClosedException
- if the connection is closed by the other partypublic void connected(org.apache.http.nio.NHttpClientConnection conn, Object attachment)
connected
in interface org.apache.http.nio.NHttpClientEventHandler
conn
- the connection being processedattachment
- the attachment set previouslypublic void closed(org.apache.http.nio.NHttpClientConnection conn)
closed
in interface org.apache.http.nio.NHttpClientEventHandler
conn
- HTTP connection to be closedpublic void timeout(org.apache.http.nio.NHttpClientConnection conn)
timeout
in interface org.apache.http.nio.NHttpClientEventHandler
conn
- the connection being processedpublic void endOfInput(org.apache.http.nio.NHttpClientConnection conn) throws IOException
endOfInput
in interface org.apache.http.nio.NHttpClientEventHandler
IOException
public void exception(org.apache.http.nio.NHttpClientConnection conn, Exception e)
exception
in interface org.apache.http.nio.NHttpClientEventHandler
public void exception(org.apache.http.nio.NHttpClientConnection conn, org.apache.http.HttpException e)
conn
- the connection being processede
- the exception encounteredpublic void exception(org.apache.http.nio.NHttpClientConnection conn, IOException e)
conn
- the connection being processede
- the exception encounteredprotected void markRequestCompletedWithError(Axis2HttpRequest axis2Request, int errorCode, String errorMessage, Exception exceptionToRaise)
axis2Request
- the Axis2HttpRequest to be marked as completed with an errorerrorCode
- the error code to raiseerrorMessage
- the text for an error message to be returned to the MR on failureexceptionToRaise
- an Exception to be returned to the MR on failurepublic void inputReady(org.apache.http.nio.NHttpClientConnection conn, org.apache.http.nio.ContentDecoder decoder)
inputReady
in interface org.apache.http.nio.NHttpClientEventHandler
conn
- connection being processeddecoder
- the content decoder in usepublic void outputReady(org.apache.http.nio.NHttpClientConnection conn, org.apache.http.nio.ContentEncoder encoder)
outputReady
in interface org.apache.http.nio.NHttpClientEventHandler
conn
- the connection being processedencoder
- the encoder in usepublic void responseReceived(org.apache.http.nio.NHttpClientConnection conn)
responseReceived
in interface org.apache.http.nio.NHttpClientEventHandler
conn
- the connection being processedpublic void execute(Runnable task)
public int getActiveCount()
public int getQueueSize()
public void stop()
Copyright © 2005-2017 Apache Software Foundation. All Rights Reserved.