@Factory @Internal @Bean(typed={NettyEmbeddedServerFactory.class,DefaultNettyEmbeddedServerFactory.class}) public class DefaultNettyEmbeddedServerFactory extends Object implements NettyEmbeddedServerFactory, NettyEmbeddedServices
NettyEmbeddedServerFactory
.Modifier | Constructor and Description |
---|---|
protected |
DefaultNettyEmbeddedServerFactory(ApplicationContext applicationContext,
RouteExecutor routeExecutor,
MediaTypeCodecRegistry mediaTypeCodecRegistry,
StaticResourceResolver staticResourceResolver,
ThreadFactory nettyThreadFactory,
HttpCompressionStrategy httpCompressionStrategy,
EventLoopGroupFactory eventLoopGroupFactory,
EventLoopGroupRegistry eventLoopGroupRegistry)
Default constructor.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getRouter
protected DefaultNettyEmbeddedServerFactory(ApplicationContext applicationContext, RouteExecutor routeExecutor, MediaTypeCodecRegistry mediaTypeCodecRegistry, StaticResourceResolver staticResourceResolver, @Named(value="netty") ThreadFactory nettyThreadFactory, HttpCompressionStrategy httpCompressionStrategy, EventLoopGroupFactory eventLoopGroupFactory, EventLoopGroupRegistry eventLoopGroupRegistry)
applicationContext
- The app ctxrouteExecutor
- The route executormediaTypeCodecRegistry
- The media type codecstaticResourceResolver
- The static resource resolvernettyThreadFactory
- The netty thread factoryhttpCompressionStrategy
- The http compression strategyeventLoopGroupFactory
- The event loop group factoryeventLoopGroupRegistry
- The event loop group registry@NonNull public NettyEmbeddedServer build(@NonNull NettyHttpServerConfiguration configuration)
NettyEmbeddedServerFactory
NettyEmbeddedServer
for the given configuration.
Note that the returned server instance should be closed gracefully by calling the NettyEmbeddedServer.stop()
method.
build
in interface NettyEmbeddedServerFactory
configuration
- The configuration, never null
NettyEmbeddedServer
instance@NonNull public NettyEmbeddedServer build(@NonNull NettyHttpServerConfiguration configuration, @Nullable ServerSslConfiguration sslConfiguration)
NettyEmbeddedServerFactory
NettyEmbeddedServer
for the given configuration.
Note that the returned server instance should be closed gracefully by calling the NettyEmbeddedServer.stop()
method.
build
in interface NettyEmbeddedServerFactory
configuration
- The configuration, never null
sslConfiguration
- The SSL configuration, can be null
if SSL is not requiredNettyEmbeddedServer
instance@Singleton @Primary @NonNull protected NettyEmbeddedServer buildDefaultServer(@NonNull NettyHttpServerConfiguration configuration)
configuration
- The server configurationNettyEmbeddedServer
instancepublic List<io.netty.channel.ChannelOutboundHandler> getOutboundHandlers()
getOutboundHandlers
in interface NettyEmbeddedServices
public ApplicationContext getApplicationContext()
getApplicationContext
in interface NettyEmbeddedServices
public RequestArgumentSatisfier getRequestArgumentSatisfier()
getRequestArgumentSatisfier
in interface NettyEmbeddedServices
RequestArgumentSatisfier
public RouteExecutor getRouteExecutor()
getRouteExecutor
in interface NettyEmbeddedServices
RouteExecutor
public MediaTypeCodecRegistry getMediaTypeCodecRegistry()
getMediaTypeCodecRegistry
in interface NettyEmbeddedServices
MediaTypeCodecRegistry
public StaticResourceResolver getStaticResourceResolver()
getStaticResourceResolver
in interface NettyEmbeddedServices
StaticResourceResolver
public ExecutorSelector getExecutorSelector()
getExecutorSelector
in interface NettyEmbeddedServices
public ServerSslBuilder getServerSslBuilder()
getServerSslBuilder
in interface NettyEmbeddedServices
null
if none is configuredCertificateProvidedSslBuilder
public ChannelOptionFactory getChannelOptionFactory()
getChannelOptionFactory
in interface NettyEmbeddedServices
public HttpCompressionStrategy getHttpCompressionStrategy()
getHttpCompressionStrategy
in interface NettyEmbeddedServices
public WebSocketBeanRegistry getWebSocketBeanRegistry()
getWebSocketBeanRegistry
in interface NettyEmbeddedServices
public EventLoopGroupRegistry getEventLoopGroupRegistry()
getEventLoopGroupRegistry
in interface NettyEmbeddedServices
public io.netty.channel.EventLoopGroup createEventLoopGroup(EventLoopGroupConfiguration config)
NettyEmbeddedServices
createEventLoopGroup
in interface NettyEmbeddedServices
config
- The configpublic io.netty.channel.socket.ServerSocketChannel getServerSocketChannelInstance(EventLoopGroupConfiguration workerConfig)
NettyEmbeddedServices
getServerSocketChannelInstance
in interface NettyEmbeddedServices
workerConfig
- The worker configServerSocketChannel
public <E> ApplicationEventPublisher<E> getEventPublisher(Class<E> eventClass)
NettyEmbeddedServices
getEventPublisher
in interface NettyEmbeddedServices
E
- The event generic typeeventClass
- The event publisher@NonNull public io.netty.channel.EventLoopGroup createEventLoopGroup(int numThreads, @NonNull ExecutorService executorService, Integer ioRatio)
NettyEmbeddedServices
createEventLoopGroup
in interface NettyEmbeddedServices
numThreads
- The number of threadsexecutorService
- The executor serviceioRatio
- The I/O ratio@Inject protected void setChannelOptionFactory(@Nullable ChannelOptionFactory channelOptionFactory)
channelOptionFactory
- The channel option factory.@Inject protected void setServerSslBuilder(@Nullable ServerSslBuilder serverSslBuilder)
ServerSslBuilder
the server ssl builder.serverSslBuilder
- The builder