org.springframework.boot.web.embedded.jetty

Class JettyWebServer

  • java.lang.Object
    • org.springframework.boot.web.embedded.jetty.JettyWebServer
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      int getPort()
      Return the port this server is listening on.
      org.eclipse.jetty.server.Server getServer()
      Returns access to the underlying Jetty Server.
      void shutDownGracefully(GracefulShutdownCallback callback)
      Initiates a graceful shutdown of the web server.
      void start()
      Starts the web server.
      void stop()
      Stops the web server.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • JettyWebServer

        public JettyWebServer(org.eclipse.jetty.server.Server server)
        Create a new JettyWebServer instance.
        Parameters:
        server - the underlying Jetty server
      • JettyWebServer

        public JettyWebServer(org.eclipse.jetty.server.Server server,
                              boolean autoStart)
        Create a new JettyWebServer instance.
        Parameters:
        server - the underlying Jetty server
        autoStart - if auto-starting the server
    • Method Detail

      • stop

        public void stop()
        Description copied from interface: WebServer
        Stops the web server. Calling this method on an already stopped server has no effect.
        Specified by:
        stop in interface WebServer
      • getPort

        public int getPort()
        Description copied from interface: WebServer
        Return the port this server is listening on.
        Specified by:
        getPort in interface WebServer
        Returns:
        the port (or -1 if none)
      • shutDownGracefully

        public void shutDownGracefully(GracefulShutdownCallback callback)
        Description copied from interface: WebServer
        Initiates a graceful shutdown of the web server. Handling of new requests is prevented and the given callback is invoked at the end of the attempt. The attempt can be explicitly ended by invoking WebServer.stop(). The default implementation invokes the callback immediately with GracefulShutdownResult.IMMEDIATE, i.e. no attempt is made at a graceful shutdown.
        Specified by:
        shutDownGracefully in interface WebServer
        Parameters:
        callback - the callback to invoke when the graceful shutdown completes
      • getServer

        public org.eclipse.jetty.server.Server getServer()
        Returns access to the underlying Jetty Server.
        Returns:
        the Jetty server