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 NettyWebServer
s.- Since:
- 2.0.0
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addRouteProviders
(NettyRouteProvider... routeProviders) AddNettyRouteProvider
s that should be applied, in order, before the handler for the Spring application.void
addServerCustomizers
(NettyServerCustomizer... serverCustomizers) AddNettyServerCustomizer
s that should be applied while building the server.Returns a mutable collection of theNettyServerCustomizer
s that will be applied to the Netty server builder.Returns the shutdown configuration that will be applied to the server.getWebServer
(org.springframework.http.server.reactive.HttpHandler httpHandler) Gets a new fully configured but pausedWebServer
instance.void
setLifecycleTimeout
(Duration lifecycleTimeout) Set the maximum amount of time that should be waited when starting or stopping the server.void
setResourceFactory
(org.springframework.http.client.ReactorResourceFactory resourceFactory) Set theReactorResourceFactory
to get the shared resources from.void
setServerCustomizers
(Collection<? extends NettyServerCustomizer> serverCustomizers) SetNettyServerCustomizer
s that should be applied to the Netty server builder.void
setShutdown
(Shutdown shutdown) Sets the shutdown configuration that will be applied to the server.void
setUseForwardHeaders
(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, getSslBundle, getSslBundles, getSslStoreProvider, setAddress, setCompression, setErrorPages, setHttp2, setPort, setServerHeader, setSsl, setSslBundles, setSslStoreProvider
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.boot.web.server.ConfigurableWebServerFactory
setAddress, setCompression, setErrorPages, setHttp2, setPort, setServerHeader, setSsl, setSslBundles, setSslStoreProvider
Methods 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:ReactiveWebServerFactory
Gets a new fully configured but pausedWebServer
instance. Clients should not be able to connect to the returned server untilWebServer.start()
is called (which happens when theApplicationContext
has 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 theNettyServerCustomizer
s that will be applied to the Netty server builder.- Returns:
- the customizers that will be applied
-
setServerCustomizers
SetNettyServerCustomizer
s that should be applied to the Netty server builder. Calling this method will replace any existing customizers.- Parameters:
serverCustomizers
- the customizers to set
-
addServerCustomizers
AddNettyServerCustomizer
s that should be applied while building the server.- Parameters:
serverCustomizers
- the customizers to add
-
addRouteProviders
AddNettyRouteProvider
s 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
public void setResourceFactory(org.springframework.http.client.ReactorResourceFactory resourceFactory) Set theReactorResourceFactory
to get the shared resources from.- Parameters:
resourceFactory
- the server resources- Since:
- 2.1.0
-
setShutdown
Description copied from interface:ConfigurableWebServerFactory
Sets the shutdown configuration that will be applied to the server.- Specified by:
setShutdown
in interfaceConfigurableWebServerFactory
- Overrides:
setShutdown
in classAbstractConfigurableWebServerFactory
- Parameters:
shutdown
- the shutdown configuration
-
getShutdown
Description copied from class:AbstractConfigurableWebServerFactory
Returns the shutdown configuration that will be applied to the server.- Overrides:
getShutdown
in classAbstractConfigurableWebServerFactory
- Returns:
- the shutdown configuration
-