Class ServerBootstrap
java.lang.Object
org.apache.hc.core5.http.impl.bootstrap.ServerBootstrap
HttpServer bootstrap.- Since:
- 4.4
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Stringprivate CharCodingConfigprivate HttpConnectionFactory<? extends DefaultBHttpServerConnection> private ConnectionReuseStrategyprivate ExceptionListenerprivate final List<FilterEntry<HttpFilterHandler>> private final List<HandlerEntry<HttpRequestHandler>> private Http1Configprivate HttpProcessorprivate intprivate InetAddressprivate LookupRegistry<HttpRequestHandler> private HttpResponseFactory<ClassicHttpResponse> private ServerSocketFactoryprivate SocketConfigprivate SSLContextprivate Callback<SSLParameters> private Http1StreamListener -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal ServerBootstrapaddFilterAfter(String existing, String name, HttpFilterHandler filterHandler) Adds the filter after the filter with the given name.final ServerBootstrapaddFilterBefore(String existing, String name, HttpFilterHandler filterHandler) Adds the filter before the filter with the given name.final ServerBootstrapaddFilterFirst(String name, HttpFilterHandler filterHandler) Add an filter to the head of the processing list.final ServerBootstrapaddFilterLast(String name, HttpFilterHandler filterHandler) Add an filter to the tail of the processing list.static ServerBootstrapcreate()final ServerBootstrapregister(String uriPattern, HttpRequestHandler requestHandler) Registers the givenHttpRequestHandleras a default handler for URIs matching the given pattern.final ServerBootstrapregisterVirtual(String hostname, String uriPattern, HttpRequestHandler requestHandler) Registers the givenHttpRequestHandleras a handler for URIs matching the given host and the pattern.final ServerBootstrapreplaceFilter(String existing, HttpFilterHandler filterHandler) Replace an existing filter with the given name with new filter.final ServerBootstrapsetCanonicalHostName(String canonicalHostName) Sets canonical name (fully qualified domain name) of the server.final ServerBootstrapsetCharCodingConfig(CharCodingConfig charCodingConfig) Sets connection configuration.final ServerBootstrapsetConnectionFactory(HttpConnectionFactory<? extends DefaultBHttpServerConnection> connectionFactory) AssignsHttpConnectionFactoryinstance.final ServerBootstrapsetConnectionReuseStrategy(ConnectionReuseStrategy connStrategy) AssignsConnectionReuseStrategyinstance.final ServerBootstrapsetExceptionListener(ExceptionListener exceptionListener) AssignsExceptionListenerinstance.final ServerBootstrapsetHttp1Config(Http1Config http1Config) Sets connection configuration.final ServerBootstrapsetHttpProcessor(HttpProcessor httpProcessor) AssignsHttpProcessorinstance.final ServerBootstrapsetListenerPort(int listenerPort) Sets listener port number.final ServerBootstrapsetLocalAddress(InetAddress localAddress) Assigns local interface for the listener.final ServerBootstrapsetLookupRegistry(LookupRegistry<HttpRequestHandler> lookupRegistry) AssignsLookupRegistryinstance.final ServerBootstrapsetResponseFactory(HttpResponseFactory<ClassicHttpResponse> responseFactory) AssignsHttpResponseFactoryinstance.final ServerBootstrapsetServerSocketFactory(ServerSocketFactory serverSocketFactory) AssignsServerSocketFactoryinstance.final ServerBootstrapsetSocketConfig(SocketConfig socketConfig) Sets socket configuration.final ServerBootstrapsetSslContext(SSLContext sslContext) AssignsSSLContextinstance.final ServerBootstrapsetSslSetupHandler(Callback<SSLParameters> sslSetupHandler) AssignsCallbackforSSLParameters.final ServerBootstrapsetStreamListener(Http1StreamListener streamListener) AssignsExceptionListenerinstance.
-
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
AssignsHttpProcessorinstance. -
setConnectionReuseStrategy
AssignsConnectionReuseStrategyinstance. -
setResponseFactory
public final ServerBootstrap setResponseFactory(HttpResponseFactory<ClassicHttpResponse> responseFactory) AssignsHttpResponseFactoryinstance. -
setLookupRegistry
AssignsLookupRegistryinstance. -
register
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(String hostname, 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
AssignsServerSocketFactoryinstance. -
setSslContext
AssignsSSLContextinstance.Please note this value can be overridden by the
setServerSocketFactory(javax.net.ServerSocketFactory)method. -
setSslSetupHandler
AssignsCallbackforSSLParameters. -
setExceptionListener
AssignsExceptionListenerinstance. -
setStreamListener
AssignsExceptionListenerinstance. -
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
-