JettyServletWebServerFactory

ServletWebServerFactory that can be used to create a JettyWebServer. Can be initialized using Spring's ServletContextInitializers or Jetty Configurations.

Unless explicitly configured otherwise this factory will create servers that listen for HTTP requests on port 8080.

Author

Phillip Webb

Dave Syer

Andrey Hihlovskiy

Andy Wilkinson

Eddú Meléndez

Venil Noronha

Henri Kerola

Moritz Halbritter

Onur Kagan Ozcan

Since

2.0.0

See also

Constructors

Link copied to clipboard
constructor()
Create a new JettyServletWebServerFactory instance.
constructor(port: Int)
Create a new JettyServletWebServerFactory that listens for requests using the specified port.
constructor(contextPath: String, port: Int)
Create a new JettyServletWebServerFactory with the specified context path and port.

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open var http2: Http2
Link copied to clipboard
Link copied to clipboard
open var jsp: Jsp
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open var port: Int
Link copied to clipboard
Link copied to clipboard
open var session: Session
Link copied to clipboard
open var shutdown: Shutdown
Link copied to clipboard
open var ssl: Ssl
Link copied to clipboard
Link copied to clipboard
open var threadPool: ThreadPool

Functions

Link copied to clipboard
open fun addConfigurations(configurations: Array<Configuration>)
Add Configurations that will be applied to the WebAppContext before the server is started.
Link copied to clipboard
open fun addCookieSameSiteSuppliers(cookieSameSiteSuppliers: Array<CookieSameSiteSupplier>)
Add CookieSameSiteSuppliers to those that should be used to obtain the SameSite attribute of any added cookie.
Link copied to clipboard
open fun addErrorPages(errorPages: Array<ErrorPage>)
Adds error pages that will be used when handling exceptions.
Link copied to clipboard
Add ServletContextInitializers to those that should be applied in addition to getWebServer parameters.
Link copied to clipboard
open fun addMimeMappings(mimeMappings: MimeMappings)
Adds mime-type mappings.
Link copied to clipboard
Add JettyServerCustomizers that will be applied to the Server before it is started.
Link copied to clipboard
open fun addWebListeners(webListenerClassNames: Array<String>)
Adds web listeners that will be registered with the servlet container.
Link copied to clipboard
open fun getConfigurations(): Collection<Configuration>
Returns a mutable collection of Jetty Configurations that will be applied to the WebAppContext before the server is created.
Link copied to clipboard
open fun getDocumentRoot(): File
Returns the document root which will be used by the web context to serve static files.
Link copied to clipboard
Returns a mutable collection of Jetty JettyServerCustomizers that will be applied to the Server before it is created.
Link copied to clipboard
Gets a new fully configured but paused WebServer instance.
Link copied to clipboard
Flag to indicate that the default servlet should be registered.
Link copied to clipboard
open fun setAcceptors(acceptors: Int)
Set the number of acceptor threads to use.
Link copied to clipboard
open fun setConfigurations(configurations: Collection<out Configuration>)
Sets Jetty Configurations that will be applied to the WebAppContext before the server is created.
Link copied to clipboard
open fun setCookieSameSiteSuppliers(cookieSameSiteSuppliers: List<out CookieSameSiteSupplier>)
Sets CookieSameSiteSuppliers that should be used to obtain the SameSite attribute of any added cookie.
Link copied to clipboard
open fun setDocumentRoot(documentRoot: File)
Sets the document root directory which will be used by the web context to serve static files.
Link copied to clipboard
open fun setErrorPages(errorPages: Set<out ErrorPage>)
Sets the error pages that will be used when handling exceptions.
Link copied to clipboard
open fun setInitializers(initializers: List<out ServletContextInitializer>)
Sets ServletContextInitializer that should be applied in addition to getWebServer parameters.
Link copied to clipboard
open fun setMaxConnections(maxConnections: Int)
Sets the maximum number of concurrent connections.
Link copied to clipboard
open fun setRegisterDefaultServlet(registerDefaultServlet: Boolean)
Set if the DefaultServlet should be registered.
Link copied to clipboard
open fun setResourceLoader(resourceLoader: ResourceLoader)
Link copied to clipboard
open fun setSelectors(selectors: Int)
Set the number of selector threads to use.
Link copied to clipboard
Sets JettyServerCustomizers that will be applied to the Server before it is started.
Link copied to clipboard
open fun setUseForwardHeaders(useForwardHeaders: Boolean)
Set if x-forward-* headers should be processed.