Class NettyReactiveWebServerFactory
java.lang.Object
org.springframework.boot.web.server.AbstractConfigurableWebServerFactory
org.springframework.boot.web.reactive.server.AbstractReactiveWebServerFactory
org.springframework.boot.web.embedded.netty.NettyReactiveWebServerFactory
- All Implemented Interfaces:
ConfigurableReactiveWebServerFactory,ReactiveWebServerFactory,ConfigurableWebServerFactory,ErrorPageRegistry,WebServerFactory
ReactiveWebServerFactory that can be used to create NettyWebServers.- Since:
- 2.0.0
- Author:
- Brian Clozel
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddRouteProviders(NettyRouteProvider... routeProviders) AddNettyRouteProviders that should be applied, in order, before the handler for the Spring application.voidaddServerCustomizers(NettyServerCustomizer... serverCustomizers) AddNettyServerCustomizers that should be applied while building the server.Returns a mutable collection of theNettyServerCustomizers that will be applied to the Netty server builder.Returns the shutdown configuration that will be applied to the server.getWebServer(HttpHandler httpHandler) Gets a new fully configured but pausedWebServerinstance.voidsetLifecycleTimeout(Duration lifecycleTimeout) Set the maximum amount of time that should be waited when starting or stopping the server.voidsetResourceFactory(ReactorResourceFactory resourceFactory) Set theReactorResourceFactoryto get the shared resources from.voidsetServerCustomizers(Collection<? extends NettyServerCustomizer> serverCustomizers) SetNettyServerCustomizers that should be applied to the Netty server builder.voidsetShutdown(Shutdown shutdown) Sets the shutdown configuration that will be applied to the server.voidsetUseForwardHeaders(boolean useForwardHeaders) Set if x-forward-* headers should be processed.Methods inherited from class org.springframework.boot.web.server.AbstractConfigurableWebServerFactory
addErrorPages, createTempDir, getAddress, getCompression, getErrorPages, getHttp2, getOrCreateSslStoreProvider, getPort, getServerHeader, getSsl, getSslStoreProvider, setAddress, setCompression, setErrorPages, setHttp2, setPort, setServerHeader, setSsl, setSslStoreProviderMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.boot.web.server.ConfigurableWebServerFactory
setAddress, setCompression, setErrorPages, setHttp2, setPort, setServerHeader, setSsl, setSslStoreProviderMethods inherited from interface org.springframework.boot.web.server.ErrorPageRegistry
addErrorPages
-
Constructor Details
-
NettyReactiveWebServerFactory
public NettyReactiveWebServerFactory() -
NettyReactiveWebServerFactory
public NettyReactiveWebServerFactory(int port)
-
-
Method Details
-
getWebServer
Description copied from interface:ReactiveWebServerFactoryGets a new fully configured but pausedWebServerinstance. Clients should not be able to connect to the returned server untilWebServer.start()is called (which happens when theApplicationContexthas been fully refreshed).- Parameters:
httpHandler- the HTTP handler in charge of processing requests- Returns:
- a fully configured and started
WebServer - See Also:
-
getServerCustomizers
Returns a mutable collection of theNettyServerCustomizers that will be applied to the Netty server builder.- Returns:
- the customizers that will be applied
-
setServerCustomizers
SetNettyServerCustomizers that should be applied to the Netty server builder. Calling this method will replace any existing customizers.- Parameters:
serverCustomizers- the customizers to set
-
addServerCustomizers
AddNettyServerCustomizers that should be applied while building the server.- Parameters:
serverCustomizers- the customizers to add
-
addRouteProviders
AddNettyRouteProviders that should be applied, in order, before the handler for the Spring application.- Parameters:
routeProviders- the route providers to add
-
setLifecycleTimeout
Set the maximum amount of time that should be waited when starting or stopping the server.- Parameters:
lifecycleTimeout- the lifecycle timeout
-
setUseForwardHeaders
public void setUseForwardHeaders(boolean useForwardHeaders) Set if x-forward-* headers should be processed.- Parameters:
useForwardHeaders- if x-forward headers should be used- Since:
- 2.1.0
-
setResourceFactory
Set theReactorResourceFactoryto get the shared resources from.- Parameters:
resourceFactory- the server resources- Since:
- 2.1.0
-
setShutdown
Description copied from interface:ConfigurableWebServerFactorySets the shutdown configuration that will be applied to the server.- Specified by:
setShutdownin interfaceConfigurableWebServerFactory- Overrides:
setShutdownin classAbstractConfigurableWebServerFactory- Parameters:
shutdown- the shutdown configuration
-
getShutdown
Description copied from class:AbstractConfigurableWebServerFactoryReturns the shutdown configuration that will be applied to the server.- Overrides:
getShutdownin classAbstractConfigurableWebServerFactory- Returns:
- the shutdown configuration
-