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