Class ServerBootstrap
java.lang.Object
org.apache.hc.core5.http.impl.bootstrap.ServerBootstrap
HttpServer
bootstrap.- Since:
- 4.4
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate String
private CharCodingConfig
private HttpConnectionFactory
<? extends DefaultBHttpServerConnection> private ConnectionReuseStrategy
private ExceptionListener
private final List
<FilterEntry<HttpFilterHandler>> private final List
<HandlerEntry<HttpRequestHandler>> private Http1Config
private HttpProcessor
private int
private InetAddress
private LookupRegistry
<HttpRequestHandler> private HttpResponseFactory
<ClassicHttpResponse> private ServerSocketFactory
private SocketConfig
private SSLContext
private Callback
<SSLParameters> private Http1StreamListener
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal ServerBootstrap
addFilterAfter
(String existing, String name, HttpFilterHandler filterHandler) Adds the filter after the filter with the given name.final ServerBootstrap
addFilterBefore
(String existing, String name, HttpFilterHandler filterHandler) Adds the filter before the filter with the given name.final ServerBootstrap
addFilterFirst
(String name, HttpFilterHandler filterHandler) Add an filter to the head of the processing list.final ServerBootstrap
addFilterLast
(String name, HttpFilterHandler filterHandler) Add an filter to the tail of the processing list.static ServerBootstrap
create()
final ServerBootstrap
register
(String uriPattern, HttpRequestHandler requestHandler) Registers the givenHttpRequestHandler
as a default handler for URIs matching the given pattern.final ServerBootstrap
registerVirtual
(String hostname, String uriPattern, HttpRequestHandler requestHandler) Registers the givenHttpRequestHandler
as a handler for URIs matching the given host and the pattern.final ServerBootstrap
replaceFilter
(String existing, HttpFilterHandler filterHandler) Replace an existing filter with the given name with new filter.final ServerBootstrap
setCanonicalHostName
(String canonicalHostName) Sets canonical name (fully qualified domain name) of the server.final ServerBootstrap
setCharCodingConfig
(CharCodingConfig charCodingConfig) Sets connection configuration.final ServerBootstrap
setConnectionFactory
(HttpConnectionFactory<? extends DefaultBHttpServerConnection> connectionFactory) AssignsHttpConnectionFactory
instance.final ServerBootstrap
setConnectionReuseStrategy
(ConnectionReuseStrategy connStrategy) AssignsConnectionReuseStrategy
instance.final ServerBootstrap
setExceptionListener
(ExceptionListener exceptionListener) AssignsExceptionListener
instance.final ServerBootstrap
setHttp1Config
(Http1Config http1Config) Sets connection configuration.final ServerBootstrap
setHttpProcessor
(HttpProcessor httpProcessor) AssignsHttpProcessor
instance.final ServerBootstrap
setListenerPort
(int listenerPort) Sets listener port number.final ServerBootstrap
setLocalAddress
(InetAddress localAddress) Assigns local interface for the listener.final ServerBootstrap
setLookupRegistry
(LookupRegistry<HttpRequestHandler> lookupRegistry) AssignsLookupRegistry
instance.final ServerBootstrap
setResponseFactory
(HttpResponseFactory<ClassicHttpResponse> responseFactory) AssignsHttpResponseFactory
instance.final ServerBootstrap
setServerSocketFactory
(ServerSocketFactory serverSocketFactory) AssignsServerSocketFactory
instance.final ServerBootstrap
setSocketConfig
(SocketConfig socketConfig) Sets socket configuration.final ServerBootstrap
setSslContext
(SSLContext sslContext) AssignsSSLContext
instance.final ServerBootstrap
setSslSetupHandler
(Callback<SSLParameters> sslSetupHandler) AssignsCallback
forSSLParameters
.final ServerBootstrap
setStreamListener
(Http1StreamListener streamListener) AssignsExceptionListener
instance.
-
Field Details
-
handlerList
-
filters
-
canonicalHostName
-
lookupRegistry
-
listenerPort
private int listenerPort -
localAddress
-
socketConfig
-
http1Config
-
charCodingConfig
-
httpProcessor
-
connStrategy
-
responseFactory
-
serverSocketFactory
-
sslContext
-
sslSetupHandler
-
connectionFactory
-
exceptionListener
-
streamListener
-
-
Constructor Details
-
ServerBootstrap
private ServerBootstrap()
-
-
Method Details
-
bootstrap
-
setCanonicalHostName
Sets canonical name (fully qualified domain name) of the server.- Since:
- 5.0
-
setListenerPort
Sets listener port number. -
setLocalAddress
Assigns local interface for the listener. -
setSocketConfig
Sets socket configuration. -
setHttp1Config
Sets connection configuration. -
setCharCodingConfig
Sets connection configuration. -
setHttpProcessor
AssignsHttpProcessor
instance. -
setConnectionReuseStrategy
AssignsConnectionReuseStrategy
instance. -
setResponseFactory
public final ServerBootstrap setResponseFactory(HttpResponseFactory<ClassicHttpResponse> responseFactory) AssignsHttpResponseFactory
instance. -
setLookupRegistry
AssignsLookupRegistry
instance. -
register
Registers the givenHttpRequestHandler
as a default handler for URIs matching the given pattern.- Parameters:
uriPattern
- the pattern to register the handler for.requestHandler
- the handler.
-
registerVirtual
public final ServerBootstrap registerVirtual(String hostname, String uriPattern, HttpRequestHandler requestHandler) Registers the givenHttpRequestHandler
as a handler for URIs matching the given host and the pattern.- Parameters:
hostname
-uriPattern
- the pattern to register the handler for.requestHandler
- the handler.
-
setConnectionFactory
public final ServerBootstrap setConnectionFactory(HttpConnectionFactory<? extends DefaultBHttpServerConnection> connectionFactory) AssignsHttpConnectionFactory
instance. -
setServerSocketFactory
AssignsServerSocketFactory
instance. -
setSslContext
AssignsSSLContext
instance.Please note this value can be overridden by the
setServerSocketFactory(javax.net.ServerSocketFactory)
method. -
setSslSetupHandler
AssignsCallback
forSSLParameters
. -
setExceptionListener
AssignsExceptionListener
instance. -
setStreamListener
AssignsExceptionListener
instance. -
addFilterBefore
public final ServerBootstrap addFilterBefore(String existing, String name, HttpFilterHandler filterHandler) Adds the filter before the filter with the given name. -
addFilterAfter
public final ServerBootstrap addFilterAfter(String existing, String name, HttpFilterHandler filterHandler) Adds the filter after the filter with the given name. -
replaceFilter
Replace an existing filter with the given name with new filter. -
addFilterFirst
Add an filter to the head of the processing list. -
addFilterLast
Add an filter to the tail of the processing list. -
create
-