Class AsyncServerBootstrap
- java.lang.Object
-
- org.apache.hc.core5.http.impl.bootstrap.AsyncServerBootstrap
-
public class AsyncServerBootstrap extends java.lang.ObjectHttpAsyncServerbootstrap.- Since:
- 5.0
-
-
Field Summary
-
Constructor Summary
Constructors Modifier Constructor Description privateAsyncServerBootstrap()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description AsyncServerBootstrapaddFilterAfter(java.lang.String existing, java.lang.String name, AsyncFilterHandler filterHandler)Adds the filter after the filter with the given name.AsyncServerBootstrapaddFilterBefore(java.lang.String existing, java.lang.String name, AsyncFilterHandler filterHandler)Adds the filter before the filter with the given name.AsyncServerBootstrapaddFilterFirst(java.lang.String name, AsyncFilterHandler filterHandler)Adds an filter to the head of the processing list.AsyncServerBootstrapaddFilterLast(java.lang.String name, AsyncFilterHandler filterHandler)Adds an filter to the tail of the processing list.static AsyncServerBootstrapbootstrap()Creates a new AsyncServerBootstrap instance.HttpAsyncServercreate()AsyncServerBootstrapregister(java.lang.String hostname, java.lang.String uriPattern, Supplier<AsyncServerExchangeHandler> supplier)Registers the givenAsyncServerExchangeHandlerSupplieras a handler for URIs matching the given host and pattern.<T> AsyncServerBootstrapregister(java.lang.String hostname, java.lang.String uriPattern, AsyncServerRequestHandler<T> requestHandler)Registers the givenAsyncServerRequestHandleras a handler for URIs matching the given host and pattern.AsyncServerBootstrapregister(java.lang.String uriPattern, Supplier<AsyncServerExchangeHandler> supplier)Registers the givenAsyncServerExchangeHandlerSupplieras a default handler for URIs matching the given pattern.<T> AsyncServerBootstrapregister(java.lang.String uriPattern, AsyncServerRequestHandler<T> requestHandler)Registers the givenAsyncServerRequestHandleras a default handler for URIs matching the given pattern.AsyncServerBootstrapregisterVirtual(java.lang.String hostname, java.lang.String uriPattern, Supplier<AsyncServerExchangeHandler> supplier)Deprecated.<T> AsyncServerBootstrapregisterVirtual(java.lang.String hostname, java.lang.String uriPattern, AsyncServerRequestHandler<T> requestHandler)Deprecated.AsyncServerBootstrapreplaceFilter(java.lang.String existing, AsyncFilterHandler filterHandler)Replaces an existing filter with the given name with new filter.AsyncServerBootstrapsetAuthorityResolver(java.util.function.BiFunction<java.lang.String,URIAuthority,URIAuthority> authorityResolver)Sets authority resolver to be used when creating theRequestRouter.AsyncServerBootstrapsetCanonicalHostName(java.lang.String canonicalHostName)Sets canonical name (fully qualified domain name) of the server.AsyncServerBootstrapsetCharCodingConfig(CharCodingConfig charCodingConfig)Sets char coding configuration.AsyncServerBootstrapsetConnectionReuseStrategy(ConnectionReuseStrategy connStrategy)SetsConnectionReuseStrategyinstance.AsyncServerBootstrapsetExceptionCallback(Callback<java.lang.Exception> exceptionCallback)SetsExceptionCallbackinstance.AsyncServerBootstrapsetHttp1Config(Http1Config http1Config)Sets HTTP/1.1 protocol parameters.AsyncServerBootstrapsetHttpProcessor(HttpProcessor httpProcessor)SetsHttpProcessorinstance.AsyncServerBootstrapsetIOReactorConfig(IOReactorConfig ioReactorConfig)Sets I/O reactor configuration.AsyncServerBootstrapsetIOReactorMetricsListener(IOReactorMetricsListener threadPoolListener)SetsIOReactorMetricsListenerinstance.AsyncServerBootstrapsetIOSessionDecorator(Decorator<IOSession> ioSessionDecorator)AsyncServerBootstrapsetIOSessionListener(IOSessionListener sessionListener)SetsIOSessionListenerinstance.AsyncServerBootstrapsetLookupRegistry(LookupRegistry<Supplier<AsyncServerExchangeHandler>> lookupRegistry)Deprecated.UseRequestRouter.AsyncServerBootstrapsetRequestRouter(HttpRequestMapper<Supplier<AsyncServerExchangeHandler>> requestRouter)SetsHttpRequestMapperinstance.AsyncServerBootstrapsetStreamListener(Http1StreamListener streamListener)SetsHttp1StreamListenerinstance.AsyncServerBootstrapsetTlsHandshakeTimeout(Timeout handshakeTimeout)Sets TLS handshakeTimeout.AsyncServerBootstrapsetTlsStrategy(TlsStrategy tlsStrategy)SetsTlsStrategyinstance.
-
-
-
Field Detail
-
routeEntries
private final java.util.List<RequestRouter.Entry<Supplier<AsyncServerExchangeHandler>>> routeEntries
-
filters
private final java.util.List<FilterEntry<AsyncFilterHandler>> filters
-
canonicalHostName
private java.lang.String canonicalHostName
-
requestRouter
private HttpRequestMapper<Supplier<AsyncServerExchangeHandler>> requestRouter
-
lookupRegistry
private LookupRegistry<Supplier<AsyncServerExchangeHandler>> lookupRegistry
-
ioReactorConfig
private IOReactorConfig ioReactorConfig
-
http1Config
private Http1Config http1Config
-
charCodingConfig
private CharCodingConfig charCodingConfig
-
httpProcessor
private HttpProcessor httpProcessor
-
connStrategy
private ConnectionReuseStrategy connStrategy
-
tlsStrategy
private TlsStrategy tlsStrategy
-
handshakeTimeout
private Timeout handshakeTimeout
-
exceptionCallback
private Callback<java.lang.Exception> exceptionCallback
-
sessionListener
private IOSessionListener sessionListener
-
streamListener
private Http1StreamListener streamListener
-
threadPoolListener
private IOReactorMetricsListener threadPoolListener
-
authorityResolver
private java.util.function.BiFunction<java.lang.String,URIAuthority,URIAuthority> authorityResolver
-
-
Method Detail
-
bootstrap
public static AsyncServerBootstrap bootstrap()
Creates a new AsyncServerBootstrap instance.- Returns:
- a new AsyncServerBootstrap instance.
-
setCanonicalHostName
public final AsyncServerBootstrap setCanonicalHostName(java.lang.String canonicalHostName)
Sets canonical name (fully qualified domain name) of the server.- Parameters:
canonicalHostName- canonical name (fully qualified domain name) of the server.- Returns:
- this instance.
-
setIOReactorConfig
public final AsyncServerBootstrap setIOReactorConfig(IOReactorConfig ioReactorConfig)
Sets I/O reactor configuration.- Parameters:
ioReactorConfig- I/O reactor configuration.- Returns:
- this instance.
-
setHttp1Config
public final AsyncServerBootstrap setHttp1Config(Http1Config http1Config)
Sets HTTP/1.1 protocol parameters.- Parameters:
http1Config- HTTP/1.1 protocol parameters.- Returns:
- this instance.
-
setCharCodingConfig
public final AsyncServerBootstrap setCharCodingConfig(CharCodingConfig charCodingConfig)
Sets char coding configuration.- Parameters:
charCodingConfig- char coding configuration.- Returns:
- this instance.
-
setHttpProcessor
public final AsyncServerBootstrap setHttpProcessor(HttpProcessor httpProcessor)
SetsHttpProcessorinstance.- Parameters:
httpProcessor-HttpProcessorinstance.- Returns:
- this instance.
-
setConnectionReuseStrategy
public final AsyncServerBootstrap setConnectionReuseStrategy(ConnectionReuseStrategy connStrategy)
SetsConnectionReuseStrategyinstance.- Parameters:
connStrategy-ConnectionReuseStrategyinstance.- Returns:
- this instance.
-
setTlsStrategy
public final AsyncServerBootstrap setTlsStrategy(TlsStrategy tlsStrategy)
SetsTlsStrategyinstance.- Parameters:
tlsStrategy-TlsStrategyinstance.- Returns:
- this instance.
-
setTlsHandshakeTimeout
public final AsyncServerBootstrap setTlsHandshakeTimeout(Timeout handshakeTimeout)
Sets TLS handshakeTimeout.- Parameters:
handshakeTimeout- TLS handshakeTimeout.- Returns:
- this instance.
-
setIOSessionDecorator
public final AsyncServerBootstrap setIOSessionDecorator(Decorator<IOSession> ioSessionDecorator)
-
setIOReactorMetricsListener
public final AsyncServerBootstrap setIOReactorMetricsListener(IOReactorMetricsListener threadPoolListener)
SetsIOReactorMetricsListenerinstance.- Returns:
- this instance.
- Since:
- 5.4
-
setExceptionCallback
public final AsyncServerBootstrap setExceptionCallback(Callback<java.lang.Exception> exceptionCallback)
SetsExceptionCallbackinstance.- Parameters:
exceptionCallback-ExceptionCallbackinstance.- Returns:
- this instance.
-
setIOSessionListener
public final AsyncServerBootstrap setIOSessionListener(IOSessionListener sessionListener)
SetsIOSessionListenerinstance.- Parameters:
sessionListener-IOSessionListenerinstance.- Returns:
- this instance.
-
setLookupRegistry
@Deprecated public final AsyncServerBootstrap setLookupRegistry(LookupRegistry<Supplier<AsyncServerExchangeHandler>> lookupRegistry)
Deprecated.UseRequestRouter.Sets a LookupRegistry for Suppliers of AsyncServerExchangeHandler.- Parameters:
lookupRegistry- LookupRegistry for Suppliers of AsyncServerExchangeHandler.- Returns:
- this instance.
-
setRequestRouter
public final AsyncServerBootstrap setRequestRouter(HttpRequestMapper<Supplier<AsyncServerExchangeHandler>> requestRouter)
SetsHttpRequestMapperinstance.- Parameters:
requestRouter-HttpRequestMapperinstance.- Returns:
- this instance.
- Since:
- 5.3
- See Also:
RequestRouter
-
setStreamListener
public final AsyncServerBootstrap setStreamListener(Http1StreamListener streamListener)
SetsHttp1StreamListenerinstance.- Parameters:
streamListener-Http1StreamListenerinstance.- Returns:
- this instance.
- Since:
- 5.0
-
setAuthorityResolver
public final AsyncServerBootstrap 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
-
register
public final AsyncServerBootstrap register(java.lang.String uriPattern, Supplier<AsyncServerExchangeHandler> supplier)
Registers the givenAsyncServerExchangeHandlerSupplieras a default handler for URIs matching the given pattern.- Parameters:
uriPattern- the non-null pattern to register the handler for.supplier- the non-null handler supplier.- Returns:
- this instance.
-
register
public final AsyncServerBootstrap register(java.lang.String hostname, java.lang.String uriPattern, Supplier<AsyncServerExchangeHandler> supplier)
Registers the givenAsyncServerExchangeHandlerSupplieras a handler for URIs matching the given host and pattern.- Parameters:
hostname- the non-null host name.uriPattern- the non-null pattern to register the handler for.supplier- the non-null handler supplier.- Returns:
- this instance.
- Since:
- 5.3
-
registerVirtual
@Deprecated public final AsyncServerBootstrap registerVirtual(java.lang.String hostname, java.lang.String uriPattern, Supplier<AsyncServerExchangeHandler> supplier)
Deprecated.Registers the givenAsyncServerExchangeHandlerSupplieras a handler for URIs matching the given host and pattern.- Parameters:
hostname- the host name.uriPattern- the pattern to register the handler for.supplier- the handler supplier.- Returns:
- this instance.
-
register
public final <T> AsyncServerBootstrap register(java.lang.String uriPattern, AsyncServerRequestHandler<T> requestHandler)
Registers the givenAsyncServerRequestHandleras a default handler for URIs matching the given pattern.- Type Parameters:
T- the AsyncServerRequestHandler request representation type.- Parameters:
uriPattern- the pattern to register the handler for.requestHandler- the handler.- Returns:
- this instance.
-
register
public final <T> AsyncServerBootstrap register(java.lang.String hostname, java.lang.String uriPattern, AsyncServerRequestHandler<T> requestHandler)
Registers the givenAsyncServerRequestHandleras a handler for URIs matching the given host and pattern.- Type Parameters:
T- the request type.- Parameters:
hostname- the host nameuriPattern- the pattern to register the handler for.requestHandler- the handler.- Returns:
- this instance.
- Since:
- 5.3
-
registerVirtual
@Deprecated public final <T> AsyncServerBootstrap registerVirtual(java.lang.String hostname, java.lang.String uriPattern, AsyncServerRequestHandler<T> requestHandler)
Deprecated.- Type Parameters:
T- the request type.- Returns:
- this instance.
-
addFilterBefore
public final AsyncServerBootstrap addFilterBefore(java.lang.String existing, java.lang.String name, AsyncFilterHandler filterHandler)
Adds the filter before the filter with the given name.- Returns:
- this instance.
-
addFilterAfter
public final AsyncServerBootstrap addFilterAfter(java.lang.String existing, java.lang.String name, AsyncFilterHandler filterHandler)
Adds the filter after the filter with the given name.- Returns:
- this instance.
-
replaceFilter
public final AsyncServerBootstrap replaceFilter(java.lang.String existing, AsyncFilterHandler filterHandler)
Replaces an existing filter with the given name with new filter.- Returns:
- this instance.
-
addFilterFirst
public final AsyncServerBootstrap addFilterFirst(java.lang.String name, AsyncFilterHandler filterHandler)
Adds an filter to the head of the processing list.- Returns:
- this instance.
-
addFilterLast
public final AsyncServerBootstrap addFilterLast(java.lang.String name, AsyncFilterHandler filterHandler)
Adds an filter to the tail of the processing list.- Returns:
- this instance.
-
create
public HttpAsyncServer create()
-
-