Class ServerBootstrap
java.lang.Object
org.apache.hc.core5.http.impl.bootstrap.ServerBootstrap
HttpServer bootstrap.- Since:
- 4.4
-
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 hostname, String uriPattern, HttpRequestHandler requestHandler) Registers the givenHttpRequestHandleras a handler for URIs matching the given host and the pattern.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) Deprecated.final ServerBootstrapreplaceFilter(String existing, HttpFilterHandler filterHandler) Replace an existing filter with the given name with new filter.final ServerBootstrapsetAuthorityResolver(BiFunction<String, URIAuthority, URIAuthority> authorityResolver) Sets authority resolver to be used when creating theRequestRouter.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) SetsHttpConnectionFactoryinstance.final ServerBootstrapsetConnectionReuseStrategy(ConnectionReuseStrategy connStrategy) SetsConnectionReuseStrategyinstance.final ServerBootstrapsetExceptionListener(ExceptionListener exceptionListener) SetsExceptionListenerinstance.final ServerBootstrapsetHttp1Config(Http1Config http1Config) Sets HTTP/1 protocol configuration.final ServerBootstrapsetHttpProcessor(HttpProcessor httpProcessor) SetsHttpProcessorinstance.final ServerBootstrapsetListenerPort(int listenerPort) Sets listener port number.final ServerBootstrapsetLocalAddress(InetAddress localAddress) Sets local interface for the listener.final ServerBootstrapsetLookupRegistry(LookupRegistry<HttpRequestHandler> lookupRegistry) Deprecated.UseRequestRouter.final ServerBootstrapsetRequestRouter(HttpRequestMapper<HttpRequestHandler> requestRouter) SetsHttpRequestMapperinstance.final ServerBootstrapsetResponseFactory(HttpResponseFactory<ClassicHttpResponse> responseFactory) SetsHttpResponseFactoryinstance.final ServerBootstrapsetServerSocketFactory(ServerSocketFactory serverSocketFactory) SetsServerSocketFactoryinstance.final ServerBootstrapsetSocketConfig(SocketConfig socketConfig) Sets socket configuration.final ServerBootstrapsetSslContext(SSLContext sslContext) SetsSSLContextinstance.final ServerBootstrapsetSslSetupHandler(Callback<SSLParameters> sslSetupHandler) SetsCallbackforSSLParameters.final ServerBootstrapsetStreamListener(Http1StreamListener streamListener) SetsExceptionListenerinstance.
-
Method Details
-
bootstrap
-
setCanonicalHostName
Sets canonical name (fully qualified domain name) of the server.- Since:
- 5.0
-
setListenerPort
Sets listener port number. -
setLocalAddress
Sets local interface for the listener. -
setSocketConfig
Sets socket configuration. -
setHttp1Config
Sets HTTP/1 protocol configuration. -
setCharCodingConfig
Sets connection configuration. -
setHttpProcessor
SetsHttpProcessorinstance. -
setConnectionReuseStrategy
SetsConnectionReuseStrategyinstance. -
setResponseFactory
public final ServerBootstrap setResponseFactory(HttpResponseFactory<ClassicHttpResponse> responseFactory) SetsHttpResponseFactoryinstance. -
setLookupRegistry
@Deprecated public final ServerBootstrap setLookupRegistry(LookupRegistry<HttpRequestHandler> lookupRegistry) Deprecated.UseRequestRouter. -
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.
-
register
public final ServerBootstrap register(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.- Since:
- 5.3
-
registerVirtual
@Deprecated public final ServerBootstrap registerVirtual(String hostname, String uriPattern, HttpRequestHandler requestHandler) Deprecated. -
setRequestRouter
SetsHttpRequestMapperinstance.- Since:
- 5.3
- See Also:
-
setConnectionFactory
public final ServerBootstrap setConnectionFactory(HttpConnectionFactory<? extends DefaultBHttpServerConnection> connectionFactory) SetsHttpConnectionFactoryinstance. -
setServerSocketFactory
SetsServerSocketFactoryinstance. -
setSslContext
SetsSSLContextinstance.Please note this value can be overridden by the
setServerSocketFactory(javax.net.ServerSocketFactory)method. -
setSslSetupHandler
SetsCallbackforSSLParameters. -
setExceptionListener
SetsExceptionListenerinstance. -
setStreamListener
SetsExceptionListenerinstance. -
setAuthorityResolver
public final ServerBootstrap setAuthorityResolver(BiFunction<String, URIAuthority, URIAuthority> authorityResolver) Sets authority resolver to be used when creating theRequestRouter.- Returns:
- this instance.
- Since:
- 5.4
-
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
-
register(String, String, HttpRequestHandler).