org.eclipse.jetty.server
类 Server

java.lang.Object
  继承者 org.eclipse.jetty.util.component.AbstractLifeCycle
      继承者 org.eclipse.jetty.util.component.AggregateLifeCycle
          继承者 org.eclipse.jetty.server.handler.AbstractHandler
              继承者 org.eclipse.jetty.server.handler.AbstractHandlerContainer
                  继承者 org.eclipse.jetty.server.handler.HandlerWrapper
                      继承者 org.eclipse.jetty.server.Server
所有已实现的接口:
Handler, HandlerContainer, Attributes, Destroyable, Dumpable, LifeCycle

public class Server
extends HandlerWrapper
implements Attributes

Jetty HTTP Servlet Server. This class is the main class for the Jetty HTTP Servlet server. It aggregates Connectors (HTTP request receivers) and request Handlers. The server is itself a handler and a ThreadPool. Connectors use the ThreadPool methods to run jobs that will eventually call the handle method.


嵌套类摘要
static interface Server.Graceful
           
 
从类 org.eclipse.jetty.util.component.AbstractLifeCycle 继承的嵌套类/接口
AbstractLifeCycle.AbstractLifeCycleListener
 
从接口 org.eclipse.jetty.util.component.LifeCycle 继承的嵌套类/接口
LifeCycle.Listener
 
字段摘要
 
从类 org.eclipse.jetty.server.handler.HandlerWrapper 继承的字段
_handler
 
从类 org.eclipse.jetty.util.component.AbstractLifeCycle 继承的字段
_listeners, FAILED, RUNNING, STARTED, STARTING, STOPPED, STOPPING
 
构造方法摘要
Server()
           
Server(InetSocketAddress addr)
          Convenience constructor Creates server and a SelectChannelConnector at the passed address.
Server(int port)
          Convenience constructor Creates server and a SelectChannelConnector at the passed port.
 
方法摘要
 boolean addBean(Object o)
          Add an associated bean.
 void addConnector(Connector connector)
           
 void addLifeCycle(LifeCycle c)
          已过时。 Use addBean(Object)
 void clearAttributes()
           
protected  void doStart()
          Start the managed lifecycle beans in the order they were added.
protected  void doStop()
          Stop the joined lifecycle beans in the reverse order they were added.
 void dump(Appendable out, String indent)
           
 Object getAttribute(String name)
           
 Enumeration getAttributeNames()
           
 Connector[] getConnectors()
           
 Container getContainer()
           
 int getGracefulShutdown()
           
 int getMaxCookieVersion()
          已过时。 
 boolean getSendDateHeader()
           
 boolean getSendServerVersion()
           
 SessionIdManager getSessionIdManager()
           
 boolean getStopAtShutdown()
           
 ThreadPool getThreadPool()
           
static String getVersion()
           
 void handle(AbstractHttpConnection connection)
           
 void handleAsync(AbstractHttpConnection connection)
           
 boolean isDumpAfterStart()
           
 boolean isDumpBeforeStop()
           
 boolean isUncheckedPrintWriter()
           
 void join()
           
static void main(String... args)
           
 void removeAttribute(String name)
           
 boolean removeBean(Object o)
          Remove an associated bean.
 void removeConnector(Connector connector)
          Conveniance method which calls getConnectors() and setConnectors(Connector[]) to remove a connector.
 void removeLifeCycle(LifeCycle c)
          已过时。 Use removeBean(Object)
 void setAttribute(String name, Object attribute)
           
 void setConnectors(Connector[] connectors)
          Set the connectors for this server.
 void setDumpAfterStart(boolean dumpAfterStart)
           
 void setDumpBeforeStop(boolean dumpBeforeStop)
           
 void setGracefulShutdown(int timeoutMS)
          Set graceful shutdown timeout.
 void setMaxCookieVersion(int maxCookieVersion)
          已过时。 
 void setSendDateHeader(boolean sendDateHeader)
           
 void setSendServerVersion(boolean sendServerVersion)
           
 void setSessionIdManager(SessionIdManager sessionIdManager)
           
 void setStopAtShutdown(boolean stop)
           
 void setThreadPool(ThreadPool threadPool)
           
 void setUncheckedPrintWriter(boolean unchecked)
           
 String toString()
           
 
从类 org.eclipse.jetty.server.handler.HandlerWrapper 继承的方法
destroy, expandChildren, getHandler, getHandlers, getNestedHandlerByClass, handle, setHandler, setServer
 
从类 org.eclipse.jetty.server.handler.AbstractHandlerContainer 继承的方法
expandHandler, findContainerOf, getChildHandlerByClass, getChildHandlers, getChildHandlersByClass
 
从类 org.eclipse.jetty.server.handler.AbstractHandler 继承的方法
dumpThis, getServer
 
从类 org.eclipse.jetty.util.component.AggregateLifeCycle 继承的方法
addBean, contains, dump, dump, dump, dump, dumpObject, dumpStdErr, getBean, getBeans, getBeans, isManaged, manage, removeBeans, unmanage
 
从类 org.eclipse.jetty.util.component.AbstractLifeCycle 继承的方法
addLifeCycleListener, getState, getState, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
从接口 org.eclipse.jetty.util.component.LifeCycle 继承的方法
addLifeCycleListener, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop
 

构造方法详细信息

Server

public Server()

Server

public Server(int port)
Convenience constructor Creates server and a SelectChannelConnector at the passed port.


Server

public Server(InetSocketAddress addr)
Convenience constructor Creates server and a SelectChannelConnector at the passed address.

方法详细信息

getVersion

public static String getVersion()

getContainer

public Container getContainer()
返回:
Returns the container.

getStopAtShutdown

public boolean getStopAtShutdown()

setStopAtShutdown

public void setStopAtShutdown(boolean stop)

getConnectors

public Connector[] getConnectors()
返回:
Returns the connectors.

addConnector

public void addConnector(Connector connector)

removeConnector

public void removeConnector(Connector connector)
Conveniance method which calls getConnectors() and setConnectors(Connector[]) to remove a connector.

参数:
connector - The connector to remove.

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.

参数:
connectors - The connectors to set.

getThreadPool

public ThreadPool getThreadPool()
返回:
Returns the threadPool.

setThreadPool

public void setThreadPool(ThreadPool threadPool)
参数:
threadPool - The threadPool to set.

isDumpAfterStart

public boolean isDumpAfterStart()
返回:
true if AggregateLifeCycle.dumpStdErr() is called after starting

setDumpAfterStart

public void setDumpAfterStart(boolean dumpAfterStart)
参数:
dumpAfterStart - true if AggregateLifeCycle.dumpStdErr() is called after starting

isDumpBeforeStop

public boolean isDumpBeforeStop()
返回:
true if AggregateLifeCycle.dumpStdErr() is called before stopping

setDumpBeforeStop

public void setDumpBeforeStop(boolean dumpBeforeStop)
参数:
dumpBeforeStop - true if AggregateLifeCycle.dumpStdErr() is called before stopping

doStart

protected void doStart()
                throws Exception
从类 AggregateLifeCycle 复制的描述
Start the managed lifecycle beans in the order they were added.

覆盖:
HandlerWrapper 中的 doStart
抛出:
Exception
另请参见:
AbstractLifeCycle.doStart()

doStop

protected void doStop()
               throws Exception
从类 AggregateLifeCycle 复制的描述
Stop the joined lifecycle beans in the reverse order they were added.

覆盖:
HandlerWrapper 中的 doStop
抛出:
Exception
另请参见:
AbstractLifeCycle.doStart()

handle

public void handle(AbstractHttpConnection connection)
            throws IOException,
                   ServletException
抛出:
IOException
ServletException

handleAsync

public void handleAsync(AbstractHttpConnection connection)
                 throws IOException,
                        ServletException
抛出:
IOException
ServletException

join

public void join()
          throws InterruptedException
抛出:
InterruptedException

getSessionIdManager

public SessionIdManager getSessionIdManager()
返回:
Returns the sessionIdManager.

setSessionIdManager

public void setSessionIdManager(SessionIdManager sessionIdManager)
参数:
sessionIdManager - The sessionIdManager to set.

setSendServerVersion

public void setSendServerVersion(boolean sendServerVersion)

getSendServerVersion

public boolean getSendServerVersion()

setSendDateHeader

public void setSendDateHeader(boolean sendDateHeader)
参数:
sendDateHeader -

getSendDateHeader

public boolean getSendDateHeader()

getMaxCookieVersion

@Deprecated
public int getMaxCookieVersion()
已过时。 


setMaxCookieVersion

@Deprecated
public void setMaxCookieVersion(int maxCookieVersion)
已过时。 


addLifeCycle

@Deprecated
public void addLifeCycle(LifeCycle c)
已过时。 Use addBean(Object)

Add a LifeCycle object to be started/stopped along with the Server.

参数:
c -

addBean

public boolean addBean(Object o)
Add an associated bean. The bean will be added to the servers Container and if it is a LifeCycle instance, it will be started/stopped along with the Server. Any beans that are also Destroyable, will be destroyed with the server.

覆盖:
AggregateLifeCycle 中的 addBean
参数:
o - the bean object to add
返回:
true if the bean was added or false if it has already been added.

removeLifeCycle

@Deprecated
public void removeLifeCycle(LifeCycle c)
已过时。 Use removeBean(Object)

Remove a LifeCycle object to be started/stopped along with the Server


removeBean

public boolean removeBean(Object o)
Remove an associated bean.

覆盖:
AggregateLifeCycle 中的 removeBean

clearAttributes

public void clearAttributes()
指定者:
接口 Attributes 中的 clearAttributes

getAttribute

public Object getAttribute(String name)
指定者:
接口 Attributes 中的 getAttribute

getAttributeNames

public Enumeration getAttributeNames()
指定者:
接口 Attributes 中的 getAttributeNames

removeAttribute

public void removeAttribute(String name)
指定者:
接口 Attributes 中的 removeAttribute

setAttribute

public void setAttribute(String name,
                         Object attribute)
指定者:
接口 Attributes 中的 setAttribute

getGracefulShutdown

public int getGracefulShutdown()
返回:
the graceful

setGracefulShutdown

public void setGracefulShutdown(int timeoutMS)
Set graceful shutdown timeout. If set, the internal doStop() method will not immediately stop the server. Instead, all Connectors will be closed so that new connections will not be accepted and all handlers that implement Server.Graceful will be put into the shutdown mode so that no new requests will be accepted, but existing requests can complete. The server will then wait the configured timeout before stopping.

参数:
timeoutMS - the milliseconds to wait for existing request to complete before stopping the server.

toString

public String toString()
覆盖:
Object 中的 toString

dump

public void dump(Appendable out,
                 String indent)
          throws IOException
指定者:
接口 Dumpable 中的 dump
覆盖:
AbstractHandlerContainer 中的 dump
抛出:
IOException

isUncheckedPrintWriter

public boolean isUncheckedPrintWriter()

setUncheckedPrintWriter

public void setUncheckedPrintWriter(boolean unchecked)

main

public static void main(String... args)
                 throws Exception
抛出:
Exception


Copyright © 2013. All Rights Reserved.