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>
DefaultIOEventDispatch
implementation 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>
connectionFactory
private H
handler
-
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 DefaultNHttpServerConnection
createConnection(IOSession session)
NHttpConnectionFactory<? extends DefaultNHttpServerConnection>
getConnectionFactory()
Gets the connection factory used to construct this dispatch.H
getHandler()
Gets the handler used to construct this dispatch.protected void
onClosed(DefaultNHttpServerConnection conn)
protected void
onConnected(DefaultNHttpServerConnection conn)
protected void
onException(DefaultNHttpServerConnection conn, java.io.IOException ex)
protected void
onInputReady(DefaultNHttpServerConnection conn)
protected void
onOutputReady(DefaultNHttpServerConnection conn)
protected void
onTimeout(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 generateHttpRequest
instances.- 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:
createConnection
in 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:
onConnected
in classAbstractIODispatch<DefaultNHttpServerConnection>
-
onClosed
protected void onClosed(DefaultNHttpServerConnection conn)
- Specified by:
onClosed
in classAbstractIODispatch<DefaultNHttpServerConnection>
-
onException
protected void onException(DefaultNHttpServerConnection conn, java.io.IOException ex)
- Specified by:
onException
in classAbstractIODispatch<DefaultNHttpServerConnection>
-
onInputReady
protected void onInputReady(DefaultNHttpServerConnection conn)
- Specified by:
onInputReady
in classAbstractIODispatch<DefaultNHttpServerConnection>
-
onOutputReady
protected void onOutputReady(DefaultNHttpServerConnection conn)
- Specified by:
onOutputReady
in classAbstractIODispatch<DefaultNHttpServerConnection>
-
onTimeout
protected void onTimeout(DefaultNHttpServerConnection conn)
- Specified by:
onTimeout
in classAbstractIODispatch<DefaultNHttpServerConnection>
-
-