Class HttpAsyncServer
- All Implemented Interfaces:
Closeable,AutoCloseable,ModalCloseable,ConnectionAcceptor,ConnectionInitiator,IOReactor,IOReactorService
- Since:
- 5.0
-
Constructor Summary
ConstructorsConstructorDescriptionHttpAsyncServer(IOEventHandlerFactory eventHandlerFactory, IOReactorConfig ioReactorConfig, Decorator<IOSession> ioSessionDecorator, Callback<Exception> exceptionCallback, IOSessionListener sessionListener) UseAsyncServerBootstrapto create instances of this class.HttpAsyncServer(IOEventHandlerFactory eventHandlerFactory, IOReactorConfig ioReactorConfig, Decorator<IOSession> ioSessionDecorator, Callback<Exception> exceptionCallback, IOSessionListener sessionListener, String canonicalName) UseAsyncServerBootstrapto create instances of this class. -
Method Summary
Modifier and TypeMethodDescriptionconnect(NamedEndpoint remoteEndpoint, SocketAddress remoteAddress, SocketAddress localAddress, Timeout timeout, Object attachment, FutureCallback<IOSession> callback) Requests a connection to a remote host.listen(SocketAddress address) Deprecated.listen(SocketAddress address, FutureCallback<ListenerEndpoint> callback) Deprecated.listen(SocketAddress address, URIScheme scheme) listen(SocketAddress address, URIScheme scheme, Object attachment, FutureCallback<ListenerEndpoint> callback) listen(SocketAddress address, URIScheme scheme, FutureCallback<ListenerEndpoint> callback) Methods inherited from class org.apache.hc.core5.http.impl.bootstrap.AsyncServer
awaitShutdown, close, close, getEndpoints, getStatus, initiateShutdown, listen, pause, resume, start
-
Constructor Details
-
HttpAsyncServer
@Internal public HttpAsyncServer(IOEventHandlerFactory eventHandlerFactory, IOReactorConfig ioReactorConfig, Decorator<IOSession> ioSessionDecorator, Callback<Exception> exceptionCallback, IOSessionListener sessionListener, String canonicalName) UseAsyncServerBootstrapto create instances of this class.- Since:
- 5.1
-
HttpAsyncServer
@Internal public HttpAsyncServer(IOEventHandlerFactory eventHandlerFactory, IOReactorConfig ioReactorConfig, Decorator<IOSession> ioSessionDecorator, Callback<Exception> exceptionCallback, IOSessionListener sessionListener) UseAsyncServerBootstrapto create instances of this class.
-
-
Method Details
-
listen
public Future<ListenerEndpoint> listen(SocketAddress address, URIScheme scheme, Object attachment, FutureCallback<ListenerEndpoint> callback) - Since:
- 5.1
-
listen
public Future<ListenerEndpoint> listen(SocketAddress address, URIScheme scheme, FutureCallback<ListenerEndpoint> callback) - Since:
- 5.1
-
listen
- Since:
- 5.1
-
listen
@Deprecated public Future<ListenerEndpoint> listen(SocketAddress address, FutureCallback<ListenerEndpoint> callback) Deprecated.Description copied from interface:ConnectionAcceptorOpens a new listener endpoint with the given socket address. Once the endpoint is fully initialized it starts accepting incoming connections and propagates I/O activity notifications to the I/O event dispatcher.- Specified by:
listenin interfaceConnectionAcceptor- Overrides:
listenin classAsyncServer- Parameters:
address- the socket address to listen on.callback- the result callback.- Returns:
- listener endpoint.
-
listen
Deprecated.- Overrides:
listenin classAsyncServer
-
connect
public final Future<IOSession> connect(NamedEndpoint remoteEndpoint, SocketAddress remoteAddress, SocketAddress localAddress, Timeout timeout, Object attachment, FutureCallback<IOSession> callback) Description copied from interface:ConnectionInitiatorRequests a connection to a remote host.Opening a connection to a remote host usually tends to be a time consuming process and may take a while to complete. One can monitor and control the process of session initialization by means of the
Futureinterface.There are several parameters one can use to exert a greater control over the process of session initialization:
A non-null local socket address parameter can be used to bind the socket to a specific local address.
An attachment object can added to the new session's context upon initialization. This object can be used to pass an initial processing state to the protocol handler.
It is often desirable to be able to react to the completion of a session request asynchronously without having to wait for it, blocking the current thread of execution. One can optionally provide an implementation
FutureCallbackinstance to get notified of events related to session requests, such as request completion, cancellation, failure or timeout.- Specified by:
connectin interfaceConnectionInitiator- Parameters:
remoteEndpoint- name of the remote host.remoteAddress- remote socket address.localAddress- local socket address. Can benull, in which can the default local address and a random port will be used.timeout- connect timeout.attachment- the attachment object. Can benull.callback- interface. Can benull.- Returns:
- session request object.
-
listen(SocketAddress, URIScheme)