Class HttpServer
java.lang.Object
org.apache.hc.core5.http.impl.bootstrap.HttpServer
- All Implemented Interfaces:
Closeable,AutoCloseable,ModalCloseable
HTTP/1.1 server side message exchange handler.
- Since:
- 4.4
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final HttpConnectionFactory<? extends DefaultBHttpServerConnection> private final ExceptionListenerprivate final HttpServiceprivate final InetAddressprivate final ThreadPoolExecutorprivate final intprivate RequestListenerprivate ServerSocketprivate final ServerSocketFactoryprivate final SocketConfigprivate final Callback<SSLParameters> private final AtomicReference<HttpServer.Status> private final WorkerPoolExecutorprivate final ThreadGroup -
Constructor Summary
ConstructorsConstructorDescriptionHttpServer(int port, HttpService httpService, InetAddress ifAddress, SocketConfig socketConfig, ServerSocketFactory serverSocketFactory, HttpConnectionFactory<? extends DefaultBHttpServerConnection> connectionFactory, Callback<SSLParameters> sslSetupHandler, ExceptionListener exceptionListener) -
Method Summary
Modifier and TypeMethodDescriptionvoidawaitTermination(TimeValue waitTime) voidclose()voidCloses this process or endpoint and releases any system resources associated with it.voidCloses this process or endpoint and releases any system resources associated with it.intvoidvoidstart()voidstop()
-
Field Details
-
port
private final int port -
ifAddress
-
socketConfig
-
serverSocketFactory
-
httpService
-
connectionFactory
-
sslSetupHandler
-
exceptionListener
-
listenerExecutorService
-
workerThreads
-
workerExecutorService
-
status
-
serverSocket
-
requestListener
-
-
Constructor Details
-
HttpServer
@Internal public HttpServer(int port, HttpService httpService, InetAddress ifAddress, SocketConfig socketConfig, ServerSocketFactory serverSocketFactory, HttpConnectionFactory<? extends DefaultBHttpServerConnection> connectionFactory, Callback<SSLParameters> sslSetupHandler, ExceptionListener exceptionListener)
-
-
Method Details
-
getInetAddress
-
getLocalPort
public int getLocalPort() -
start
- Throws:
IOException
-
stop
public void stop() -
initiateShutdown
public void initiateShutdown() -
awaitTermination
- Throws:
InterruptedException
-
close
Description copied from interface:ModalCloseableCloses this process or endpoint and releases any system resources associated with it. If the endpoint or the process is already closed then invoking this method has no effect.- Specified by:
closein interfaceModalCloseable- Parameters:
closeMode- How to close the receiver.
-
close
Closes this process or endpoint and releases any system resources associated with it. If the endpoint or the process is already closed then invoking this method has no effect.- Parameters:
closeMode- How to close the receiver.timeout- How long to wait for the HttpServer to close gracefully.- Since:
- 5.2
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-