@Singleton @Internal public class NettyHttpServer extends Object implements EmbeddedServer, WebSocketSessionRepository
EmbeddedServer.RoutingInBoundHandler| Modifier and Type | Field and Description |
|---|---|
static String |
HTTP_CHUNKED_HANDLER |
static String |
HTTP_CODEC |
static String |
HTTP_COMPRESSOR |
static String |
HTTP_DECOMPRESSOR |
static String |
HTTP_KEEP_ALIVE_HANDLER |
static String |
HTTP_STREAMS_CODEC |
static String |
MICRONAUT_HANDLER |
static String |
OUTBOUND_KEY |
| Constructor and Description |
|---|
NettyHttpServer(NettyHttpServerConfiguration serverConfiguration,
ApplicationContext applicationContext,
Router router,
RequestArgumentSatisfier requestArgumentSatisfier,
MediaTypeCodecRegistry mediaTypeCodecRegistry,
NettyCustomizableResponseTypeHandlerRegistry customizableResponseTypeHandlerRegistry,
StaticResourceResolver resourceResolver,
ExecutorService ioExecutor,
ThreadFactory threadFactory,
ExecutorSelector executorSelector,
Optional<ServerSslBuilder> serverSslBuilder,
List<io.netty.channel.ChannelOutboundHandler> outboundHandlers,
EventLoopGroupFactory eventLoopGroupFactory,
HttpCompressionStrategy httpCompressionStrategy) |
| 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() |
ApplicationConfiguration |
getApplicationConfiguration() |
ApplicationContext |
getApplicationContext()
Resolves the
ApplicationContext for this class. |
io.netty.channel.group.ChannelGroup |
getChannelGroup()
Returns the
ChannelGroup used to store WebSocketSessions. |
String |
getHost() |
int |
getPort() |
String |
getScheme() |
NettyHttpServerConfiguration |
getServerConfiguration() |
URI |
getURI() |
URL |
getURL() |
WebSocketSessionRepository |
getWebSocketSessionRepository() |
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, isForceExitpublic static final String HTTP_STREAMS_CODEC
public static final String HTTP_CHUNKED_HANDLER
public static final String HTTP_CODEC
public static final String HTTP_COMPRESSOR
public static final String HTTP_DECOMPRESSOR
public static final String HTTP_KEEP_ALIVE_HANDLER
public static final String MICRONAUT_HANDLER
public static final String OUTBOUND_KEY
@Inject public NettyHttpServer(NettyHttpServerConfiguration serverConfiguration, ApplicationContext applicationContext, Router router, RequestArgumentSatisfier requestArgumentSatisfier, MediaTypeCodecRegistry mediaTypeCodecRegistry, NettyCustomizableResponseTypeHandlerRegistry customizableResponseTypeHandlerRegistry, StaticResourceResolver resourceResolver, @Named(value="io") ExecutorService ioExecutor, @Named(value="netty") ThreadFactory threadFactory, ExecutorSelector executorSelector, Optional<ServerSslBuilder> serverSslBuilder, List<io.netty.channel.ChannelOutboundHandler> outboundHandlers, EventLoopGroupFactory eventLoopGroupFactory, HttpCompressionStrategy httpCompressionStrategy)
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 handlerseventLoopGroupFactory - The EventLoopGroupFactoryhttpCompressionStrategy - The http compression strategypublic 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 String getHost()
getHost in interface EmbeddedServerpublic String getScheme()
getScheme in interface EmbeddedServerpublic URL getURL()
getURL in interface EmbeddedServerpublic 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()
protected 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 WebSocketSessionRepository