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