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