Class JettyWebServer
java.lang.Object
org.springframework.boot.jetty.JettyWebServer
- All Implemented Interfaces:
org.springframework.boot.web.server.WebServer
- Direct Known Subclasses:
JettyServletWebServer
WebServer that can be used to control a Jetty web server.- Since:
- 4.0.0
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionJettyWebServer(org.eclipse.jetty.server.Server server) Create a newJettyWebServerinstance.JettyWebServer(org.eclipse.jetty.server.Server server, boolean autoStart) Create a newJettyWebServerinstance. -
Method Summary
Modifier and TypeMethodDescriptionvoiddestroy()intgetPort()org.eclipse.jetty.server.ServerReturns access to the underlying Jetty Server.protected voidhandleDeferredInitialize(org.eclipse.jetty.server.Server server) Performs any necessary handling of deferred initialization.voidshutDownGracefully(org.springframework.boot.web.server.GracefulShutdownCallback callback) Initiates a graceful shutdown of the Jetty web server.voidstart()voidstop()
-
Constructor Details
-
JettyWebServer
public JettyWebServer(org.eclipse.jetty.server.Server server) Create a newJettyWebServerinstance.- Parameters:
server- the underlying Jetty server
-
JettyWebServer
public JettyWebServer(org.eclipse.jetty.server.Server server, boolean autoStart) Create a newJettyWebServerinstance.- Parameters:
server- the underlying Jetty serverautoStart- if auto-starting the server
-
-
Method Details
-
start
public void start() throws org.springframework.boot.web.server.WebServerException- Specified by:
startin interfaceorg.springframework.boot.web.server.WebServer- Throws:
org.springframework.boot.web.server.WebServerException
-
handleDeferredInitialize
-
stop
public void stop()- Specified by:
stopin interfaceorg.springframework.boot.web.server.WebServer
-
destroy
public void destroy()- Specified by:
destroyin interfaceorg.springframework.boot.web.server.WebServer
-
getPort
public int getPort()- Specified by:
getPortin interfaceorg.springframework.boot.web.server.WebServer
-
shutDownGracefully
public void shutDownGracefully(org.springframework.boot.web.server.GracefulShutdownCallback callback) Initiates a graceful shutdown of the Jetty web server. Handling of new requests is prevented and the givencallbackis invoked at the end of the attempt. The attempt can be explicitly ended by invokingstop().Once shutdown has been initiated Jetty will reject any new connections. Requests on existing connections will be accepted, however, a
Connection: closeheader will be returned in the response.- Specified by:
shutDownGracefullyin interfaceorg.springframework.boot.web.server.WebServer
-
getServer
public org.eclipse.jetty.server.Server getServer()Returns access to the underlying Jetty Server.- Returns:
- the Jetty server
-