org.springframework.boot.web.server

Interface WebServer

    • Method Detail

      • start

        void start()
            throws WebServerException
        Starts the web server. Calling this method on an already started server has no effect.
        Throws:
        WebServerException - if the server cannot be started
      • stop

        void stop()
           throws WebServerException
        Stops the web server. Calling this method on an already stopped server has no effect.
        Throws:
        WebServerException - if the server cannot be stopped
      • getPort

        int getPort()
        Return the port this server is listening on.
        Returns:
        the port (or -1 if none)
      • shutDownGracefully

        default void shutDownGracefully(GracefulShutdownCallback callback)
        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 stop(). The default implementation invokes the callback immediately with GracefulShutdownResult.IMMEDIATE, i.e. no attempt is made at a graceful shutdown.
        Parameters:
        callback - the callback to invoke when the graceful shutdown completes
        Since:
        2.3.0