@Singleton @Internal public class NettyHttpServer extends java.lang.Object implements EmbeddedServer, WebSocketSessionRepository, ChannelPipelineCustomizer
EmbeddedServer.RoutingInBoundHandler| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
OUTBOUND_KEY |
HANDLER_ACCESS_LOGGER, HANDLER_CONNECT_TTL, HANDLER_FLOW_CONTROL, HANDLER_HTTP_AGGREGATOR, HANDLER_HTTP_CHUNK, HANDLER_HTTP_CLIENT_CODEC, HANDLER_HTTP_CLIENT_INIT, HANDLER_HTTP_COMPRESSOR, HANDLER_HTTP_DECODER, HANDLER_HTTP_DECOMPRESSOR, HANDLER_HTTP_KEEP_ALIVE, HANDLER_HTTP_PROXY, HANDLER_HTTP_SERVER_CODEC, HANDLER_HTTP_STREAM, HANDLER_HTTP2_CONNECTION, HANDLER_HTTP2_PROTOCOL_NEGOTIATOR, HANDLER_HTTP2_SETTINGS, HANDLER_HTTP2_UPGRADE_REQUEST, HANDLER_IDLE_STATE, HANDLER_MICRONAUT_FULL_HTTP_RESPONSE, HANDLER_MICRONAUT_HTTP_RESPONSE_FULL, HANDLER_MICRONAUT_HTTP_RESPONSE_STREAM, HANDLER_MICRONAUT_INBOUND, HANDLER_MICRONAUT_SSE_CONTENT, HANDLER_MICRONAUT_SSE_EVENT_STREAM, HANDLER_MICRONAUT_WEBSOCKET_CLIENT, HANDLER_READ_TIMEOUT, HANDLER_SOCKS_5_PROXY, HANDLER_SSL, HANDLER_WEBSOCKET_UPGRADE| Constructor and Description |
|---|
NettyHttpServer(NettyHttpServerConfiguration serverConfiguration,
ApplicationContext applicationContext,
Router router,
RequestArgumentSatisfier requestArgumentSatisfier,
MediaTypeCodecRegistry mediaTypeCodecRegistry,
NettyCustomizableResponseTypeHandlerRegistry customizableResponseTypeHandlerRegistry,
StaticResourceResolver resourceResolver,
javax.inject.Provider<java.util.concurrent.ExecutorService> ioExecutor,
java.util.concurrent.ThreadFactory threadFactory,
ExecutorSelector executorSelector,
ServerSslBuilder serverSslBuilder,
java.util.List<io.netty.channel.ChannelOutboundHandler> outboundHandlers,
EventLoopGroupFactory eventLoopGroupFactory,
EventLoopGroupRegistry eventLoopGroupRegistry,
HttpCompressionStrategy httpCompressionStrategy,
HttpContentProcessorResolver httpContentProcessorResolver,
ChannelOptionFactory channelOptionFactory) |
| Modifier and Type | Method and Description |
|---|---|
void |
addChannel(io.netty.channel.Channel channel)
Adds a channel to the repository.
|
protected io.netty.channel.EventLoopGroup |
createParentEventLoopGroup() |
protected io.netty.bootstrap.ServerBootstrap |
createServerBootstrap() |
protected io.netty.channel.EventLoopGroup |
createWorkerEventLoopGroup(EventLoopGroupConfiguration workerConfig) |
void |
doOnConnect(ChannelPipelineListener listener)
A hook to customize the pipeline upon establishing a connection.
|
ApplicationConfiguration |
getApplicationConfiguration() |
ApplicationContext |
getApplicationContext()
Resolves the
ApplicationContext for this class. |
io.netty.channel.group.ChannelGroup |
getChannelGroup()
Returns the
ChannelGroup used to store WebSocketSessions. |
java.lang.String |
getHost() |
int |
getPort() |
java.lang.String |
getScheme() |
NettyHttpServerConfiguration |
getServerConfiguration() |
java.net.URI |
getURI() |
java.net.URL |
getURL() |
WebSocketSessionRepository |
getWebSocketSessionRepository() |
boolean |
isClientChannel() |
boolean |
isKeepAlive()
Most servers provide a way to block such that the server doesn't exit, however some require the creation of a keep alive thread.
|
boolean |
isRunning() |
void |
removeChannel(io.netty.channel.Channel channel)
Remove a channel from the repository.
|
EmbeddedServer |
start()
Starts the lifecyle component.
|
EmbeddedServer |
stop()
Stops the life cycle component.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitisServergetEnvironment, isForceExitisServerChannelpublic static final java.lang.String OUTBOUND_KEY
public NettyHttpServer(NettyHttpServerConfiguration serverConfiguration, ApplicationContext applicationContext, Router router, RequestArgumentSatisfier requestArgumentSatisfier, MediaTypeCodecRegistry mediaTypeCodecRegistry, NettyCustomizableResponseTypeHandlerRegistry customizableResponseTypeHandlerRegistry, StaticResourceResolver resourceResolver, @Named(value="io") javax.inject.Provider<java.util.concurrent.ExecutorService> ioExecutor, @Named(value="netty") java.util.concurrent.ThreadFactory threadFactory, ExecutorSelector executorSelector, @Nullable ServerSslBuilder serverSslBuilder, java.util.List<io.netty.channel.ChannelOutboundHandler> outboundHandlers, EventLoopGroupFactory eventLoopGroupFactory, EventLoopGroupRegistry eventLoopGroupRegistry, HttpCompressionStrategy httpCompressionStrategy, HttpContentProcessorResolver httpContentProcessorResolver, ChannelOptionFactory channelOptionFactory)
serverConfiguration - The Netty HTTP server configurationapplicationContext - The application contextrouter - The routerrequestArgumentSatisfier - The request argument satisfiermediaTypeCodecRegistry - The Media type codec registrycustomizableResponseTypeHandlerRegistry - The Netty customizable response type handler registryresourceResolver - The static resource resolverioExecutor - The IO executorthreadFactory - The thread factoryexecutorSelector - The executor selectorserverSslBuilder - The Netty Server SSL builderoutboundHandlers - The outbound handlerseventLoopGroupRegistry - The event loop registryeventLoopGroupFactory - The EventLoopGroupFactoryhttpCompressionStrategy - The http compression strategyhttpContentProcessorResolver - The http content processor resolverchannelOptionFactory - The channel option factorypublic boolean isKeepAlive()
EmbeddedServerisKeepAlive in interface EmbeddedServerpublic NettyHttpServerConfiguration getServerConfiguration()
public boolean isRunning()
public EmbeddedServer start()
LifeCyclestart in interface ApplicationContextLifeCycle<EmbeddedServer>start in interface LifeCyclepublic EmbeddedServer stop()
LifeCyclestop in interface ApplicationContextLifeCycle<EmbeddedServer>stop in interface LifeCyclepublic int getPort()
getPort in interface EmbeddedServerpublic java.lang.String getHost()
getHost in interface EmbeddedServerpublic java.lang.String getScheme()
getScheme in interface EmbeddedServerpublic java.net.URL getURL()
getURL in interface EmbeddedServerpublic java.net.URI getURI()
getURI in interface EmbeddedServerpublic ApplicationContext getApplicationContext()
ApplicationContextProviderApplicationContext for this class.getApplicationContext in interface ApplicationContextProvidergetApplicationContext in interface EmbeddedApplication<EmbeddedServer>ApplicationContext for the serverpublic ApplicationConfiguration getApplicationConfiguration()
getApplicationConfiguration in interface EmbeddedApplication<EmbeddedServer>ApplicationConfiguration instanceprotected io.netty.channel.EventLoopGroup createParentEventLoopGroup()
protected io.netty.channel.EventLoopGroup createWorkerEventLoopGroup(@Nullable
EventLoopGroupConfiguration workerConfig)
workerConfig - The worker configurationprotected io.netty.bootstrap.ServerBootstrap createServerBootstrap()
public void addChannel(io.netty.channel.Channel channel)
WebSocketSessionRepositoryaddChannel in interface WebSocketSessionRepositorychannel - The channelpublic void removeChannel(io.netty.channel.Channel channel)
WebSocketSessionRepositoryremoveChannel in interface WebSocketSessionRepositorychannel - The channelpublic io.netty.channel.group.ChannelGroup getChannelGroup()
WebSocketSessionRepositoryChannelGroup used to store WebSocketSessions.getChannelGroup in interface WebSocketSessionRepositoryChannelGrouppublic WebSocketSessionRepository getWebSocketSessionRepository()
NettyHttpServer which implements WebSocketSessionRepositorypublic boolean isClientChannel()
isClientChannel in interface ChannelPipelineCustomizerpublic void doOnConnect(@NonNull
ChannelPipelineListener listener)
ChannelPipelineCustomizerdoOnConnect in interface ChannelPipelineCustomizerlistener - The listener The listener.