Class NettyReactiveWebServerFactory
java.lang.Object
org.springframework.boot.web.server.AbstractConfigurableWebServerFactory
org.springframework.boot.web.server.reactive.AbstractReactiveWebServerFactory
org.springframework.boot.reactor.netty.NettyReactiveWebServerFactory
- All Implemented Interfaces:
ErrorPageRegistry, ConfigurableWebServerFactory, ConfigurableReactiveWebServerFactory, ReactiveWebServerFactory, WebServerFactory
ReactiveWebServerFactory that can be used to create NettyWebServers.- Since:
- 4.0.0
- Author:
- Brian Clozel, Moritz Halbritter, Scott Frederick
-
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.getWebServer(HttpHandler httpHandler) Gets a new fully configured but pausedWebServerinstance.voidsetLifecycleTimeout(@Nullable Duration lifecycleTimeout) Set the maximum amount of time that should be waited when starting or stopping the server.voidsetResourceFactory(@Nullable ReactorResourceFactory resourceFactory) Set theReactorResourceFactoryto get the shared resources from.voidsetServerCustomizers(Collection<? extends NettyServerCustomizer> serverCustomizers) SetNettyServerCustomizers that should be applied to the Netty server builder.voidsetUseForwardHeaders(boolean useForwardHeaders) Set if x-forward-* headers should be processed.Methods inherited from class AbstractConfigurableWebServerFactory
addErrorPages, createTempDir, getAddress, getCompression, getErrorPages, getHttp2, getPort, getServerHeader, getServerNameSslBundles, getShutdown, getSsl, getSslBundle, getSslBundles, setAddress, setCompression, setErrorPages, setHttp2, setPort, setServerHeader, setShutdown, setSsl, setSslBundlesMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ConfigurableWebServerFactory
setAddress, setCompression, setErrorPages, setHttp2, setPort, setServerHeader, setShutdown, setSsl, setSslBundlesMethods inherited from interface 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
-
setResourceFactory
Set theReactorResourceFactoryto get the shared resources from.- Parameters:
resourceFactory- the server resources
-