Top Description Inners Fields Constructors Methods
org.apache.hc.core5.http.impl.bootstrap

public Class HttpServer

extends Object
implements ModalCloseable
Class Inheritance
All Implemented Interfaces
org.apache.hc.core5.io.ModalCloseable, java.io.Closeable, java.lang.AutoCloseable
Imports
java.io.IOException, java.net.InetAddress, .ServerSocket, java.util.Set, java.util.concurrent.SynchronousQueue, .ThreadPoolExecutor, .TimeUnit, java.util.concurrent.atomic.AtomicReference, javax.net.ServerSocketFactory, javax.net.ssl.SSLParameters, .SSLServerSocket, .SSLServerSocketFactory, org.apache.hc.core5.annotation.Internal, org.apache.hc.core5.concurrent.DefaultThreadFactory, org.apache.hc.core5.function.Callback, org.apache.hc.core5.http.ExceptionListener, .URIScheme, org.apache.hc.core5.http.config.CharCodingConfig, .Http1Config, org.apache.hc.core5.http.impl.io.DefaultBHttpServerConnection, .DefaultBHttpServerConnectionFactory, .HttpService, org.apache.hc.core5.http.io.HttpConnectionFactory, .SocketConfig, org.apache.hc.core5.io.CloseMode, .Closer, .ModalCloseable, org.apache.hc.core5.util.Args, .TimeValue, .Timeout

HTTP/1.1 server side message exchange handler.
Since
4.4

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static enum

Field Summary

Modifier and TypeField and Description
private final HttpConnectionFactory<? extends DefaultBHttpServerConnection>
private final ExceptionListener
private final HttpService
private final InetAddress
private final ThreadPoolExecutor
private final int
private volatile RequestListener
private volatile ServerSocket
private final ServerSocketFactory
private final SocketConfig
private final Callback<SSLParameters>
private final AtomicReference<HttpServer.Status>
private final WorkerPoolExecutor
private final ThreadGroup

Constructor Summary

AccessConstructor and Description
public
HttpServer(final int port, final HttpService httpService, final InetAddress ifAddress, final SocketConfig socketConfig, final ServerSocketFactory serverSocketFactory, final HttpConnectionFactory<? extends DefaultBHttpServerConnection> connectionFactory, final Callback<SSLParameters> sslSetupHandler, final ExceptionListener exceptionListener)

Method Summary

Modifier and TypeMethod and Description
public void
awaitTermination(final TimeValue waitTime)

public void
close(final CloseMode
How to close the receiver.
closeMode
)

Implements org.apache.hc.core5.io.ModalCloseable.close.

Closes this process or endpoint and releases any system resources associated with it.
public void
close(final CloseMode
How to close the receiver.
closeMode
,
final Timeout
How long to wait for the HttpServer to close gracefully.
timeout
)

Closes this process or endpoint and releases any system resources associated with it.

public void
close()

Implements java.io.Closeable.close.

Closes this stream and releases any system resources associated with it.
public InetAddress
public int
public void
public void
public void
stop()

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

connectionFactoryback to summary
private final HttpConnectionFactory<? extends DefaultBHttpServerConnection> connectionFactory
exceptionListenerback to summary
private final ExceptionListener exceptionListener
httpServiceback to summary
private final HttpService httpService
ifAddressback to summary
private final InetAddress ifAddress
listenerExecutorServiceback to summary
private final ThreadPoolExecutor listenerExecutorService
portback to summary
private final int port
requestListenerback to summary
private volatile RequestListener requestListener
serverSocketback to summary
private volatile ServerSocket serverSocket
serverSocketFactoryback to summary
private final ServerSocketFactory serverSocketFactory
socketConfigback to summary
private final SocketConfig socketConfig
sslSetupHandlerback to summary
private final Callback<SSLParameters> sslSetupHandler
statusback to summary
private final AtomicReference<HttpServer.Status> status
workerExecutorServiceback to summary
private final WorkerPoolExecutor workerExecutorService
workerThreadsback to summary
private final ThreadGroup workerThreads

Constructor Detail

HttpServerback to summary
public HttpServer(final int port, final HttpService httpService, final InetAddress ifAddress, final SocketConfig socketConfig, final ServerSocketFactory serverSocketFactory, final HttpConnectionFactory<? extends DefaultBHttpServerConnection> connectionFactory, final Callback<SSLParameters> sslSetupHandler, final ExceptionListener exceptionListener)
Annotations
@Internal

Method Detail

awaitTerminationback to summary
public void awaitTermination(final TimeValue waitTime) throws InterruptedException
closeback to summary
public void close(final CloseMode closeMode)

Implements org.apache.hc.core5.io.ModalCloseable.close.

Doc from org.apache.hc.core5.io.ModalCloseable.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:CloseMode

How to close the receiver.

Annotations
@Override
closeback to summary
public void close(final CloseMode closeMode, final Timeout timeout)

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:CloseMode

How to close the receiver.

timeout:Timeout

How long to wait for the HttpServer to close gracefully.

Since
5.2
closeback to summary
public void close()

Implements java.io.Closeable.close.

Doc from java.io.Closeable.close.

Closes this stream and releases any system resources associated with it. If the stream is already closed then invoking this method has no effect.

As noted in AutoCloseable#close(), cases where the close may fail require careful attention. It is strongly advised to relinquish the underlying resources and to internally mark the Closeable as closed, prior to throwing the IOException.

Annotations
@Override
getInetAddressback to summary
public InetAddress getInetAddress()
getLocalPortback to summary
public int getLocalPort()
initiateShutdownback to summary
public void initiateShutdown()
startback to summary
public void start() throws IOException
stopback to summary
public void stop()
org.apache.hc.core5.http.impl.bootstrap back to summary

pack-priv final Enum HttpServer.Status

extends Enum<HttpServer.Status>
Class Inheritance

Field Summary

Modifier and TypeField and Description
public static final HttpServer.Status
public static final HttpServer.Status
public static final HttpServer.Status

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static HttpServer.Status
public static HttpServer.Status[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

ACTIVEback to summary
public static final HttpServer.Status ACTIVE
READYback to summary
public static final HttpServer.Status READY
STOPPINGback to summary
public static final HttpServer.Status STOPPING

Constructor Detail

Statusback to summary
private Status()

Method Detail

valueOfback to summary
public static HttpServer.Status valueOf(String name)
valuesback to summary
public static HttpServer.Status[] values()