Package org.apache.http.impl.nio
Class DefaultHttpClientIODispatch<H extends NHttpClientEventHandler>
- java.lang.Object
-
- org.apache.http.impl.nio.reactor.AbstractIODispatch<DefaultNHttpClientConnection>
-
- org.apache.http.impl.nio.DefaultHttpClientIODispatch<H>
-
- Type Parameters:
H- an implementation ofNHttpClientEventHandler.
- All Implemented Interfaces:
IOEventDispatch
@Contract(threading=IMMUTABLE_CONDITIONAL) public class DefaultHttpClientIODispatch<H extends NHttpClientEventHandler> extends AbstractIODispatch<DefaultNHttpClientConnection>
DefaultIOEventDispatchimplementation that supports both plain (non-encrypted) and SSL encrypted client side HTTP connections.- Since:
- 4.2
-
-
Field Summary
Fields Modifier and Type Field Description private NHttpConnectionFactory<? extends DefaultNHttpClientConnection>connectionFactoryprivate Hhandler-
Fields inherited from interface org.apache.http.nio.reactor.IOEventDispatch
CONNECTION_KEY
-
-
Constructor Summary
Constructors Constructor Description DefaultHttpClientIODispatch(H handler, javax.net.ssl.SSLContext sslContext, ConnectionConfig config)DefaultHttpClientIODispatch(H handler, javax.net.ssl.SSLContext sslContext, SSLSetupHandler sslHandler, ConnectionConfig config)DefaultHttpClientIODispatch(H handler, javax.net.ssl.SSLContext sslContext, SSLSetupHandler sslHandler, HttpParams params)DefaultHttpClientIODispatch(H handler, javax.net.ssl.SSLContext sslContext, HttpParams params)Deprecated.DefaultHttpClientIODispatch(H handler, ConnectionConfig config)DefaultHttpClientIODispatch(H handler, NHttpConnectionFactory<? extends DefaultNHttpClientConnection> connFactory)Creates a new instance of this class to be used for dispatching I/O event notifications to the given protocol handler.DefaultHttpClientIODispatch(H handler, HttpParams params)Deprecated.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <T extends NHttpClientEventHandler>
DefaultHttpClientIODispatch<T>create(T handler, javax.net.ssl.SSLContext sslContext, ConnectionConfig config)Creates a new instance of this class to be used for dispatching I/O event notifications to the given protocol handler.static <T extends NHttpClientEventHandler>
DefaultHttpClientIODispatch<T>create(T handler, javax.net.ssl.SSLContext sslContext, SSLSetupHandler sslHandler, ConnectionConfig config)Creates a new instance of this class to be used for dispatching I/O event notifications to the given protocol handler.protected DefaultNHttpClientConnectioncreateConnection(IOSession session)NHttpConnectionFactory<? extends DefaultNHttpClientConnection>getConnectionFactory()Gets the connection factory used to construct this dispatch.HgetHandler()Gets the handler used to construct this dispatch.protected voidonClosed(DefaultNHttpClientConnection conn)protected voidonConnected(DefaultNHttpClientConnection conn)protected voidonException(DefaultNHttpClientConnection conn, java.io.IOException ex)protected voidonInputReady(DefaultNHttpClientConnection conn)protected voidonOutputReady(DefaultNHttpClientConnection conn)protected voidonTimeout(DefaultNHttpClientConnection conn)-
Methods inherited from class org.apache.http.impl.nio.reactor.AbstractIODispatch
connected, disconnected, inputReady, outputReady, timeout
-
-
-
-
Field Detail
-
handler
private final H extends NHttpClientEventHandler handler
-
connectionFactory
private final NHttpConnectionFactory<? extends DefaultNHttpClientConnection> connectionFactory
-
-
Constructor Detail
-
DefaultHttpClientIODispatch
public DefaultHttpClientIODispatch(H handler, NHttpConnectionFactory<? extends DefaultNHttpClientConnection> connFactory)
Creates a new instance of this class to be used for dispatching I/O event notifications to the given protocol handler.- Parameters:
handler- the client protocol handler.connFactory- HTTP client connection factory.
-
DefaultHttpClientIODispatch
@Deprecated public DefaultHttpClientIODispatch(H handler, HttpParams params)
Deprecated.
-
DefaultHttpClientIODispatch
@Deprecated public DefaultHttpClientIODispatch(H handler, javax.net.ssl.SSLContext sslContext, SSLSetupHandler sslHandler, HttpParams params)
-
DefaultHttpClientIODispatch
@Deprecated public DefaultHttpClientIODispatch(H handler, javax.net.ssl.SSLContext sslContext, HttpParams params)
Deprecated.
-
DefaultHttpClientIODispatch
public DefaultHttpClientIODispatch(H handler, ConnectionConfig config)
- Since:
- 4.3
-
DefaultHttpClientIODispatch
public DefaultHttpClientIODispatch(H handler, javax.net.ssl.SSLContext sslContext, SSLSetupHandler sslHandler, ConnectionConfig config)
- Since:
- 4.3
-
DefaultHttpClientIODispatch
public DefaultHttpClientIODispatch(H handler, javax.net.ssl.SSLContext sslContext, ConnectionConfig config)
- Since:
- 4.3
-
-
Method Detail
-
create
public static <T extends NHttpClientEventHandler> DefaultHttpClientIODispatch<T> create(T handler, javax.net.ssl.SSLContext sslContext, ConnectionConfig config)
Creates a new instance of this class to be used for dispatching I/O event notifications to the given protocol handler.- Parameters:
handler- the client protocol handler.sslContext- an SSLContext or null (for a plain text connection.)config- a connection configuration- Returns:
- a new instance
- Since:
- 4.4.7
-
create
public static <T extends NHttpClientEventHandler> DefaultHttpClientIODispatch<T> create(T handler, javax.net.ssl.SSLContext sslContext, SSLSetupHandler sslHandler, ConnectionConfig config)
Creates a new instance of this class to be used for dispatching I/O event notifications to the given protocol handler.- Parameters:
handler- the client protocol handler.sslContext- an SSLContext or null (for a plain text connection.)sslHandler- customizes various aspects of the TLS/SSL protocol.config- a connection configuration- Returns:
- a new instance
- Since:
- 4.4.7
-
createConnection
protected DefaultNHttpClientConnection createConnection(IOSession session)
- Specified by:
createConnectionin classAbstractIODispatch<DefaultNHttpClientConnection>
-
getConnectionFactory
public NHttpConnectionFactory<? extends DefaultNHttpClientConnection> getConnectionFactory()
Gets the connection factory used to construct this dispatch.- Returns:
- the connection factory used to construct this dispatch.
- Since:
- 4.4.9
-
getHandler
public H getHandler()
Gets the handler used to construct this dispatch.- Returns:
- the handler used to construct this dispatch.
- Since:
- 4.4.9
-
onConnected
protected void onConnected(DefaultNHttpClientConnection conn)
- Specified by:
onConnectedin classAbstractIODispatch<DefaultNHttpClientConnection>
-
onClosed
protected void onClosed(DefaultNHttpClientConnection conn)
- Specified by:
onClosedin classAbstractIODispatch<DefaultNHttpClientConnection>
-
onException
protected void onException(DefaultNHttpClientConnection conn, java.io.IOException ex)
- Specified by:
onExceptionin classAbstractIODispatch<DefaultNHttpClientConnection>
-
onInputReady
protected void onInputReady(DefaultNHttpClientConnection conn)
- Specified by:
onInputReadyin classAbstractIODispatch<DefaultNHttpClientConnection>
-
onOutputReady
protected void onOutputReady(DefaultNHttpClientConnection conn)
- Specified by:
onOutputReadyin classAbstractIODispatch<DefaultNHttpClientConnection>
-
onTimeout
protected void onTimeout(DefaultNHttpClientConnection conn)
- Specified by:
onTimeoutin classAbstractIODispatch<DefaultNHttpClientConnection>
-
-