Class HttpServer

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable, ModalCloseable

    public class HttpServer
    extends java.lang.Object
    implements ModalCloseable
    HTTP/1.1 server side message exchange handler.
    Since:
    4.4
    • Field Detail

      • port

        private final int port
      • ifAddress

        private final java.net.InetAddress ifAddress
      • serverSocketFactory

        private final javax.net.ServerSocketFactory serverSocketFactory
      • sslSetupHandler

        private final Callback<javax.net.ssl.SSLParameters> sslSetupHandler
      • listenerExecutorService

        private final java.util.concurrent.ThreadPoolExecutor listenerExecutorService
      • workerThreads

        private final java.lang.ThreadGroup workerThreads
      • status

        private final java.util.concurrent.atomic.AtomicReference<HttpServer.Status> status
      • serverSocket

        private volatile java.net.ServerSocket serverSocket
    • Method Detail

      • getInetAddress

        public java.net.InetAddress getInetAddress()
      • getLocalPort

        public int getLocalPort()
      • start

        public void start()
                   throws java.io.IOException
        Throws:
        java.io.IOException
      • stop

        public void stop()
      • initiateShutdown

        public void initiateShutdown()
      • awaitTermination

        public void awaitTermination​(TimeValue waitTime)
                              throws java.lang.InterruptedException
        Throws:
        java.lang.InterruptedException
      • close

        public void close​(CloseMode closeMode)
        Description copied from interface: ModalCloseable
        Closes this process or endpoint and releases any system resources associated with it. If the endpoint or the process is already closed then invoking this method has no effect.
        Specified by:
        close in interface ModalCloseable
        Parameters:
        closeMode - How to close the receiver.
      • close

        public void close​(CloseMode closeMode,
                          Timeout timeout)
        Closes this process or endpoint and releases any system resources associated with it. If the endpoint or the process is already closed then invoking this method has no effect.
        Parameters:
        closeMode - How to close the receiver.
        timeout - How long to wait for the HttpServer to close gracefully.
        Since:
        5.2
      • close

        public void close()
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable