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 ExceptionListener
private final HttpService
private final InetAddress
private final ThreadPoolExecutor
private final int
private RequestListener
private ServerSocket
private final ServerSocketFactory
private final SocketConfig
private final Callback
<SSLParameters> private final AtomicReference
<HttpServer.Status> private final WorkerPoolExecutor
private 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 TypeMethodDescriptionvoid
awaitTermination
(TimeValue waitTime) void
close()
void
Closes this process or endpoint and releases any system resources associated with it.void
Closes this process or endpoint and releases any system resources associated with it.int
void
void
start()
void
stop()
-
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:ModalCloseable
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.- Specified by:
close
in 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:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
-