public static class NettyHttpService.Builder extends Object
| Modifier | Constructor and Description |
|---|---|
protected |
Builder(String serviceName) |
| Modifier and Type | Method and Description |
|---|---|
NettyHttpService |
build() |
NettyHttpService.Builder |
enableSSL(SSLConfig sslConfig)
Enable SSL by using the provided SSL information.
|
NettyHttpService.Builder |
enableSSL(SSLHandlerFactory sslHandlerFactory)
Enable SSL by using the given
SSLHandlerFactory to create SslHandler. |
NettyHttpService.Builder |
setBossThreadPoolSize(int bossThreadPoolSize)
Set size of bossThreadPool in netty default value is 1 if it is not set.
|
NettyHttpService.Builder |
setChannelConfig(io.netty.channel.ChannelOption<?> channelOption,
Object value)
Sets channel configuration for the netty service.
|
NettyHttpService.Builder |
setChannelPipelineModifier(ChannelPipelineModifier pipelineModifier)
|
NettyHttpService.Builder |
setChildChannelConfig(io.netty.channel.ChannelOption<?> channelOption,
Object value)
Sets channel configuration for the child socket channel for the netty service.
|
NettyHttpService.Builder |
setConnectionBacklog(int connectionBacklog)
Set size of backlog in netty service - size of accept queue of the TCP stack.
|
NettyHttpService.Builder |
setExceptionHandler(ExceptionHandler exceptionHandler)
Set the
ExceptionHandler for the service. |
NettyHttpService.Builder |
setExecThreadKeepAliveSeconds(long threadKeepAliveSecs)
Set the maximum time that excess idle threads will wait for new tasks before terminating.
|
NettyHttpService.Builder |
setExecThreadPoolSize(int execThreadPoolSize)
Set size of executorThreadPool in netty default value is 60 if it is not set.
|
NettyHttpService.Builder |
setHandlerHooks(Iterable<? extends HandlerHook> handlerHooks)
Set HandlerHooks to be executed pre and post handler calls.
|
NettyHttpService.Builder |
setHost(String host)
Set the bindAddress for the service.
|
NettyHttpService.Builder |
setHttpChunkLimit(int value)
Set the HTTP chunk limit.
|
NettyHttpService.Builder |
setHttpHandlers(HttpHandler... handlers)
Add HttpHandlers that service the request.
|
NettyHttpService.Builder |
setHttpHandlers(Iterable<? extends HttpHandler> handlers)
Add HttpHandlers that service the request.
|
NettyHttpService.Builder |
setPort(int port)
Set the port on which the service should listen to.
|
NettyHttpService.Builder |
setRejectedExecutionHandler(RejectedExecutionHandler rejectedExecutionHandler)
Set RejectedExecutionHandler - rejection policy for executor.
|
NettyHttpService.Builder |
setUrlRewriter(URLRewriter urlRewriter)
Set URLRewriter to re-write URL of an incoming request before any handlers or their hooks are called.
|
NettyHttpService.Builder |
setWorkerThreadPoolSize(int workerThreadPoolSize)
Set size of workerThreadPool in netty default value is 10 if it is not set.
|
protected Builder(String serviceName)
public NettyHttpService.Builder setChannelPipelineModifier(ChannelPipelineModifier pipelineModifier)
pipelineModifier - the modifier to usepublic NettyHttpService.Builder setHttpHandlers(Iterable<? extends HttpHandler> handlers)
handlers - Iterable of HttpHandlers.Builder.public NettyHttpService.Builder setHttpHandlers(HttpHandler... handlers)
handlers - a list of HttpHandlers to addBuilder.public NettyHttpService.Builder setHandlerHooks(Iterable<? extends HandlerHook> handlerHooks)
handlerHooks - Iterable of HandlerHooks.Builder.public NettyHttpService.Builder setUrlRewriter(URLRewriter urlRewriter)
urlRewriter - instance of URLRewriter.Builder.public NettyHttpService.Builder setBossThreadPoolSize(int bossThreadPoolSize)
bossThreadPoolSize - size of bossThreadPool.Builder.public NettyHttpService.Builder setWorkerThreadPoolSize(int workerThreadPoolSize)
workerThreadPoolSize - size of workerThreadPool.Builder.public NettyHttpService.Builder setConnectionBacklog(int connectionBacklog)
connectionBacklog - backlog in netty server. Default value is 1000.Builder.public NettyHttpService.Builder setChannelConfig(io.netty.channel.ChannelOption<?> channelOption, Object value)
channelOption - the ChannelOption to setvalue - Value of the configuration.Builder.ChannelConfig,
ServerSocketChannelConfigpublic NettyHttpService.Builder setChildChannelConfig(io.netty.channel.ChannelOption<?> channelOption, Object value)
channelOption - the ChannelOption to setvalue - Value of the configuration.Builder.ChannelConfig,
ServerSocketChannelConfigpublic NettyHttpService.Builder setExecThreadPoolSize(int execThreadPoolSize)
<= 0, then no executor will be used, hence calls to HttpHandler would be made from
worker threads directly.execThreadPoolSize - size of workerThreadPool.Builder.public NettyHttpService.Builder setExecThreadKeepAliveSeconds(long threadKeepAliveSecs)
<= 0, then idle threads will not be terminated.threadKeepAliveSecs - thread keep alive seconds.Builder.public NettyHttpService.Builder setRejectedExecutionHandler(RejectedExecutionHandler rejectedExecutionHandler)
rejectedExecutionHandler - rejectionExecutionHandler.Builder.public NettyHttpService.Builder setPort(int port)
port - port on which the service should listen to.Builder.public NettyHttpService.Builder setHost(String host)
host - bindAddress for the service.Builder.public NettyHttpService.Builder setHttpChunkLimit(int value)
value - the chunk limitBuilder.public NettyHttpService.Builder enableSSL(SSLConfig sslConfig)
sslConfig - the SSL configurationBuilder.public NettyHttpService.Builder enableSSL(SSLHandlerFactory sslHandlerFactory)
SSLHandlerFactory to create SslHandler.sslHandlerFactory - the factory for creating SslHandlersBuilder.public NettyHttpService.Builder setExceptionHandler(ExceptionHandler exceptionHandler)
ExceptionHandler for the service.exceptionHandler - the exception handler to useBuilder.public NettyHttpService build()
NettyHttpServiceCopyright 2019 Cask, Inc. Licensed under the Apache License, Version 2.0