Class Server

    • Constructor Detail

      • Server

        public Server()
      • Server

        public Server​(@Name("port")
                      int port)
        Convenience constructor Creates server and a ServerConnector at the passed port.
        Parameters:
        port - The port of a network HTTP connector (or 0 for a randomly allocated port).
        See Also:
        NetworkConnector.getLocalPort()
      • Server

        public Server​(@Name("address")
                      java.net.InetSocketAddress addr)
        Convenience constructor

        Creates server and a ServerConnector at the passed address.

        Parameters:
        addr - the inet socket address to create the connector from
    • Method Detail

      • getRequestLog

        public RequestLog getRequestLog()
      • setRequestLog

        public void setRequestLog​(RequestLog requestLog)
      • setErrorHandler

        public void setErrorHandler​(ErrorHandler errorHandler)
      • getVersion

        @ManagedAttribute("version of this server")
        public static java.lang.String getVersion()
      • getStopAtShutdown

        public boolean getStopAtShutdown()
      • setStopAtShutdown

        public void setStopAtShutdown​(boolean stop)
        Set stop server at shutdown behaviour.
        Parameters:
        stop - If true, this server instance will be explicitly stopped when the JVM is shutdown. Otherwise the JVM is stopped with the server running.
        See Also:
        Runtime.addShutdownHook(Thread), ShutdownThread
      • addConnector

        public void addConnector​(Connector connector)
      • setConnectors

        public void setConnectors​(Connector[] connectors)
        Set the connectors for this server. Each connector has this server set as it's ThreadPool and its Handler.
        Parameters:
        connectors - The connectors to set.
      • setDumpAfterStart

        public void setDumpAfterStart​(boolean dumpAfterStart)
        Parameters:
        dumpAfterStart - true if ContainerLifeCycle.dumpStdErr() is called after starting
      • setDumpBeforeStop

        public void setDumpBeforeStop​(boolean dumpBeforeStop)
        Parameters:
        dumpBeforeStop - true if ContainerLifeCycle.dumpStdErr() is called before stopping
      • getDateField

        public HttpField getDateField()
      • doStart

        protected void doStart()
                        throws java.lang.Exception
        Description copied from class: ContainerLifeCycle
        Starts the managed lifecycle beans in the order they were added.
        Overrides:
        doStart in class AbstractHandler
        Throws:
        java.lang.Exception
      • start

        protected void start​(LifeCycle l)
                      throws java.lang.Exception
        Description copied from class: ContainerLifeCycle
        Starts the given lifecycle.
        Overrides:
        start in class ContainerLifeCycle
        Parameters:
        l - the lifecycle to start
        Throws:
        java.lang.Exception - if unable to start lifecycle
      • doStop

        protected void doStop()
                       throws java.lang.Exception
        Description copied from class: ContainerLifeCycle
        Stops the managed lifecycle beans in the reverse order they were added.
        Overrides:
        doStop in class AbstractHandler
        Throws:
        java.lang.Exception
      • handle

        public void handle​(HttpChannel channel)
                    throws java.io.IOException,
                           javax.servlet.ServletException
        Throws:
        java.io.IOException
        javax.servlet.ServletException
      • handleOptions

        protected void handleOptions​(Request request,
                                     Response response)
                              throws java.io.IOException
        Throws:
        java.io.IOException
      • handleAsync

        public void handleAsync​(HttpChannel channel)
                         throws java.io.IOException,
                                javax.servlet.ServletException
        Throws:
        java.io.IOException
        javax.servlet.ServletException
      • join

        public void join()
                  throws java.lang.InterruptedException
        Throws:
        java.lang.InterruptedException
      • getSessionIdManager

        public SessionIdManager getSessionIdManager()
        Returns:
        Returns the sessionIdManager.
      • setSessionIdManager

        public void setSessionIdManager​(SessionIdManager sessionIdManager)
        Parameters:
        sessionIdManager - The sessionIdManager to set.
      • getAttribute

        public java.lang.Object getAttribute​(java.lang.String name)
        Specified by:
        getAttribute in interface Attributes
      • getAttributeNames

        public java.util.Enumeration<java.lang.String> getAttributeNames()
        Specified by:
        getAttributeNames in interface Attributes
      • removeAttribute

        public void removeAttribute​(java.lang.String name)
        Specified by:
        removeAttribute in interface Attributes
      • setAttribute

        public void setAttribute​(java.lang.String name,
                                 java.lang.Object attribute)
        Specified by:
        setAttribute in interface Attributes
      • dump

        public void dump​(java.lang.Appendable out,
                         java.lang.String indent)
                  throws java.io.IOException
        Description copied from interface: Dumpable
        Dump this object (and children) into an Appendable using the provided indent after any new lines. The indent should not be applied to the first object dumped.
        Specified by:
        dump in interface Dumpable
        Overrides:
        dump in class ContainerLifeCycle
        Parameters:
        out - The appendable to dump to
        indent - The indent to apply after any new lines.
        Throws:
        java.io.IOException - if unable to write to Appendable
      • main

        public static void main​(java.lang.String... args)
                         throws java.lang.Exception
        Throws:
        java.lang.Exception