Class ServerBootstrap
- java.lang.Object
-
- org.apache.hc.core5.http.impl.bootstrap.ServerBootstrap
-
public class ServerBootstrap extends java.lang.ObjectHttpServerbootstrap.- Since:
- 4.4
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.StringcanonicalHostNameprivate CharCodingConfigcharCodingConfigprivate HttpConnectionFactory<? extends DefaultBHttpServerConnection>connectionFactoryprivate ConnectionReuseStrategyconnStrategyprivate ExceptionListenerexceptionListenerprivate java.util.List<FilterEntry<HttpFilterHandler>>filtersprivate java.util.List<HandlerEntry<HttpRequestHandler>>handlerListprivate Http1Confighttp1Configprivate HttpProcessorhttpProcessorprivate intlistenerPortprivate java.net.InetAddresslocalAddressprivate LookupRegistry<HttpRequestHandler>lookupRegistryprivate HttpResponseFactory<ClassicHttpResponse>responseFactoryprivate javax.net.ServerSocketFactoryserverSocketFactoryprivate SocketConfigsocketConfigprivate javax.net.ssl.SSLContextsslContextprivate Callback<javax.net.ssl.SSLParameters>sslSetupHandlerprivate Http1StreamListenerstreamListener
-
Constructor Summary
Constructors Modifier Constructor Description privateServerBootstrap()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ServerBootstrapaddFilterAfter(java.lang.String existing, java.lang.String name, HttpFilterHandler filterHandler)Adds the filter after the filter with the given name.ServerBootstrapaddFilterBefore(java.lang.String existing, java.lang.String name, HttpFilterHandler filterHandler)Adds the filter before the filter with the given name.ServerBootstrapaddFilterFirst(java.lang.String name, HttpFilterHandler filterHandler)Add an filter to the head of the processing list.ServerBootstrapaddFilterLast(java.lang.String name, HttpFilterHandler filterHandler)Add an filter to the tail of the processing list.static ServerBootstrapbootstrap()HttpServercreate()ServerBootstrapregister(java.lang.String uriPattern, HttpRequestHandler requestHandler)Registers the givenHttpRequestHandleras a default handler for URIs matching the given pattern.ServerBootstrapregisterVirtual(java.lang.String hostname, java.lang.String uriPattern, HttpRequestHandler requestHandler)Registers the givenHttpRequestHandleras a handler for URIs matching the given host and the pattern.ServerBootstrapreplaceFilter(java.lang.String existing, HttpFilterHandler filterHandler)Replace an existing filter with the given name with new filter.ServerBootstrapsetCanonicalHostName(java.lang.String canonicalHostName)Sets canonical name (fully qualified domain name) of the server.ServerBootstrapsetCharCodingConfig(CharCodingConfig charCodingConfig)Sets connection configuration.ServerBootstrapsetConnectionFactory(HttpConnectionFactory<? extends DefaultBHttpServerConnection> connectionFactory)AssignsHttpConnectionFactoryinstance.ServerBootstrapsetConnectionReuseStrategy(ConnectionReuseStrategy connStrategy)AssignsConnectionReuseStrategyinstance.ServerBootstrapsetExceptionListener(ExceptionListener exceptionListener)AssignsExceptionListenerinstance.ServerBootstrapsetHttp1Config(Http1Config http1Config)Sets connection configuration.ServerBootstrapsetHttpProcessor(HttpProcessor httpProcessor)AssignsHttpProcessorinstance.ServerBootstrapsetListenerPort(int listenerPort)Sets listener port number.ServerBootstrapsetLocalAddress(java.net.InetAddress localAddress)Assigns local interface for the listener.ServerBootstrapsetLookupRegistry(LookupRegistry<HttpRequestHandler> lookupRegistry)AssignsLookupRegistryinstance.ServerBootstrapsetResponseFactory(HttpResponseFactory<ClassicHttpResponse> responseFactory)AssignsHttpResponseFactoryinstance.ServerBootstrapsetServerSocketFactory(javax.net.ServerSocketFactory serverSocketFactory)AssignsServerSocketFactoryinstance.ServerBootstrapsetSocketConfig(SocketConfig socketConfig)Sets socket configuration.ServerBootstrapsetSslContext(javax.net.ssl.SSLContext sslContext)AssignsSSLContextinstance.ServerBootstrapsetSslSetupHandler(Callback<javax.net.ssl.SSLParameters> sslSetupHandler)AssignsCallbackforSSLParameters.ServerBootstrapsetStreamListener(Http1StreamListener streamListener)AssignsExceptionListenerinstance.
-
-
-
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)
AssignsHttpProcessorinstance.
-
setConnectionReuseStrategy
public final ServerBootstrap setConnectionReuseStrategy(ConnectionReuseStrategy connStrategy)
AssignsConnectionReuseStrategyinstance.
-
setResponseFactory
public final ServerBootstrap setResponseFactory(HttpResponseFactory<ClassicHttpResponse> responseFactory)
AssignsHttpResponseFactoryinstance.
-
setLookupRegistry
public final ServerBootstrap setLookupRegistry(LookupRegistry<HttpRequestHandler> lookupRegistry)
AssignsLookupRegistryinstance.
-
register
public final ServerBootstrap register(java.lang.String uriPattern, HttpRequestHandler requestHandler)
Registers the givenHttpRequestHandleras 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 givenHttpRequestHandleras 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)
AssignsHttpConnectionFactoryinstance.
-
setServerSocketFactory
public final ServerBootstrap setServerSocketFactory(javax.net.ServerSocketFactory serverSocketFactory)
AssignsServerSocketFactoryinstance.
-
setSslContext
public final ServerBootstrap setSslContext(javax.net.ssl.SSLContext sslContext)
AssignsSSLContextinstance.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)
AssignsCallbackforSSLParameters.
-
setExceptionListener
public final ServerBootstrap setExceptionListener(ExceptionListener exceptionListener)
AssignsExceptionListenerinstance.
-
setStreamListener
public final ServerBootstrap setStreamListener(Http1StreamListener streamListener)
AssignsExceptionListenerinstance.
-
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()
-
-