Class JettyReactiveWebServerFactory
java.lang.Object
org.springframework.boot.web.server.AbstractConfigurableWebServerFactory
org.springframework.boot.web.reactive.server.AbstractReactiveWebServerFactory
org.springframework.boot.web.embedded.jetty.JettyReactiveWebServerFactory
- All Implemented Interfaces:
ConfigurableJettyWebServerFactory
,ConfigurableReactiveWebServerFactory
,ReactiveWebServerFactory
,ConfigurableWebServerFactory
,ErrorPageRegistry
,WebServerFactory
public class JettyReactiveWebServerFactory
extends AbstractReactiveWebServerFactory
implements ConfigurableJettyWebServerFactory
ReactiveWebServerFactory
that can be used to create JettyWebServer
s.- Since:
- 2.0.0
- Author:
- Brian Clozel, Moritz Halbritter
-
Constructor Summary
ConstructorDescriptionCreate a newJettyServletWebServerFactory
instance.JettyReactiveWebServerFactory
(int port) Create a newJettyServletWebServerFactory
that listens for requests using the specified port. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addServerCustomizers
(JettyServerCustomizer... customizers) AddJettyServerCustomizer
s that will be applied to theServer
before it is started.protected org.eclipse.jetty.server.Server
createJettyServer
(JettyHttpHandlerAdapter servlet) protected JettyResourceFactory
Returns a mutable collection of JettyJettyServerCustomizer
s that will be applied to theServer
before it is created.org.eclipse.jetty.util.thread.ThreadPool
Returns a JettyThreadPool
that should be used by theServer
.getWebServer
(HttpHandler httpHandler) Gets a new fully configured but pausedWebServer
instance.void
setAcceptors
(int acceptors) Set the number of acceptor threads to use.void
setMaxConnections
(int maxConnections) Sets the maximum number of concurrent connections.void
setResourceFactory
(JettyResourceFactory resourceFactory) Set theJettyResourceFactory
to get the shared resources from.void
setSelectors
(int selectors) Set the number of selector threads to use.void
setServerCustomizers
(Collection<? extends JettyServerCustomizer> customizers) SetsJettyServerCustomizer
s that will be applied to theServer
before it is started.void
setThreadPool
(org.eclipse.jetty.util.thread.ThreadPool threadPool) Set theThreadPool
that should be used by theServer
.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, getPort, getServerHeader, getShutdown, getSsl, getSslBundle, getSslBundles, setAddress, setCompression, setErrorPages, setHttp2, setPort, setServerHeader, setShutdown, setSsl, setSslBundles
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, setShutdown, setSsl, setSslBundles
Methods inherited from interface org.springframework.boot.web.server.ErrorPageRegistry
addErrorPages
-
Constructor Details
-
JettyReactiveWebServerFactory
public JettyReactiveWebServerFactory()Create a newJettyServletWebServerFactory
instance. -
JettyReactiveWebServerFactory
public JettyReactiveWebServerFactory(int port) Create a newJettyServletWebServerFactory
that listens for requests using the specified port.- Parameters:
port
- the port to listen on
-
-
Method Details
-
setUseForwardHeaders
public void setUseForwardHeaders(boolean useForwardHeaders) Description copied from interface:ConfigurableJettyWebServerFactory
Set if x-forward-* headers should be processed.- Specified by:
setUseForwardHeaders
in interfaceConfigurableJettyWebServerFactory
- Parameters:
useForwardHeaders
- if x-forward headers should be used
-
setAcceptors
public void setAcceptors(int acceptors) Description copied from interface:ConfigurableJettyWebServerFactory
Set the number of acceptor threads to use.- Specified by:
setAcceptors
in interfaceConfigurableJettyWebServerFactory
- Parameters:
acceptors
- the number of acceptor threads to use
-
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).- Specified by:
getWebServer
in interfaceReactiveWebServerFactory
- Parameters:
httpHandler
- the HTTP handler in charge of processing requests- Returns:
- a fully configured and started
WebServer
- See Also:
-
addServerCustomizers
Description copied from interface:ConfigurableJettyWebServerFactory
AddJettyServerCustomizer
s that will be applied to theServer
before it is started.- Specified by:
addServerCustomizers
in interfaceConfigurableJettyWebServerFactory
- Parameters:
customizers
- the customizers to add
-
setMaxConnections
public void setMaxConnections(int maxConnections) Description copied from interface:ConfigurableJettyWebServerFactory
Sets the maximum number of concurrent connections.- Specified by:
setMaxConnections
in interfaceConfigurableJettyWebServerFactory
- Parameters:
maxConnections
- the maximum number of concurrent connections
-
setServerCustomizers
SetsJettyServerCustomizer
s that will be applied to theServer
before it is started. Calling this method will replace any existing customizers.- Parameters:
customizers
- the Jetty customizers to apply
-
getServerCustomizers
Returns a mutable collection of JettyJettyServerCustomizer
s that will be applied to theServer
before it is created.- Returns:
- the Jetty customizers
-
getThreadPool
public org.eclipse.jetty.util.thread.ThreadPool getThreadPool()Returns a JettyThreadPool
that should be used by theServer
.- Returns:
- a Jetty
ThreadPool
ornull
-
setThreadPool
public void setThreadPool(org.eclipse.jetty.util.thread.ThreadPool threadPool) Description copied from interface:ConfigurableJettyWebServerFactory
Set theThreadPool
that should be used by theServer
. If set tonull
(default), theServer
creates aThreadPool
implicitly.- Specified by:
setThreadPool
in interfaceConfigurableJettyWebServerFactory
- Parameters:
threadPool
- the ThreadPool to be used
-
setSelectors
public void setSelectors(int selectors) Description copied from interface:ConfigurableJettyWebServerFactory
Set the number of selector threads to use.- Specified by:
setSelectors
in interfaceConfigurableJettyWebServerFactory
- Parameters:
selectors
- the number of selector threads to use
-
setResourceFactory
Set theJettyResourceFactory
to get the shared resources from.- Parameters:
resourceFactory
- the server resources- Since:
- 2.1.0
-
getResourceFactory
-
createJettyServer
-