* Please note this value can be overridden by the {@link #setConnectionFactory(
*HttpConnectionFactory)} method.
*/
public final ServerBootstrap setConnectionConfig(final ConnectionConfig connectionConfig) {
this.connectionConfig = connectionConfig;
return this;
}
/**
* Assigns {@link HttpProcessor} instance.
*/
public final ServerBootstrap setHttpProcessor(final HttpProcessor httpProcessor) {
this.httpProcessor = httpProcessor;
return this;
}
/**
* Assigns {@link ConnectionReuseStrategy} instance.
*/
public final ServerBootstrap setConnectionReuseStrategy(final ConnectionReuseStrategy connStrategy) {
this.connStrategy = connStrategy;
return this;
}
/**
* Assigns {@link HttpResponseFactory} instance.
*/
public final ServerBootstrap setResponseFactory(final HttpResponseFactory
* Please note this value can be overridden by the {@link #setHandlerMapper(
*HttpRequestHandlerMapper)} method.
*
* @param pattern the pattern to register the handler for.
* @param handler the handler.
*/
public final ServerBootstrap registerHandler(final String pattern, final HttpRequestHandler handler) {
if (pattern == null || handler == null) {
return this;
}
if (handlerMap == null) {
handlerMap = new HashMap<>();
}
handlerMap.put(pattern, handler);
return this;
}
/**
* Assigns {@link HttpExpectationVerifier} instance.
*/
public final ServerBootstrap setExpectationVerifier(final HttpExpectationVerifier expectationVerifier) {
this.expectationVerifier = expectationVerifier;
return this;
}
/**
* Assigns {@link HttpConnectionFactory} instance.
*/
public final ServerBootstrap setConnectionFactory(
final HttpConnectionFactory extends DefaultBHttpServerConnection> connectionFactory) {
this.connectionFactory = connectionFactory;
return this;
}
/**
* Assigns {@link SSLServerSetupHandler} instance.
*/
public final ServerBootstrap setSslSetupHandler(final SSLServerSetupHandler sslSetupHandler) {
this.sslSetupHandler = sslSetupHandler;
return this;
}
/**
* Assigns {@link javax.net.ServerSocketFactory} instance.
*/
public final ServerBootstrap setServerSocketFactory(final ServerSocketFactory serverSocketFactory) {
this.serverSocketFactory = serverSocketFactory;
return this;
}
/**
* Assigns {@link javax.net.ssl.SSLContext} instance.
*
* Please note this value can be overridden by the {@link #setServerSocketFactory(
* javax.net.ServerSocketFactory)} method.
*/
public final ServerBootstrap setSslContext(final SSLContext sslContext) {
this.sslContext = sslContext;
return this;
}
/**
* Assigns {@link ExceptionListener} instance.
*/
public final ServerBootstrap setExceptionListener(final ExceptionListener exceptionListener) {
this.exceptionListener = exceptionListener;
return this;
}
/**
* Assigns {@link ExceptionListener} instance.
*/
public final ServerBootstrap setStreamListener(final Http1StreamListener streamListener) {
this.streamListener = streamListener;
return this;
}
public HttpServer create() {
HttpProcessor httpProcessorCopy = this.httpProcessor;
if (httpProcessorCopy == null) {
httpProcessorCopy = HttpProcessors.server();
}
HttpRequestHandlerMapper handlerMapperCopy = this.handlerMapper;
if (handlerMapperCopy == null) {
final UriHttpRequestHandlerMapper reqistry = new UriHttpRequestHandlerMapper();
if (handlerMap != null) {
for (final Map.Entry