|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.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
public class Server
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.
| Nested Class Summary | |
|---|---|
static interface |
Server.Graceful
|
| Nested classes/interfaces inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle |
|---|
AbstractLifeCycle.AbstractLifeCycleListener |
| Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.LifeCycle |
|---|
LifeCycle.Listener |
| Field Summary |
|---|
| Fields inherited from class org.eclipse.jetty.server.handler.HandlerWrapper |
|---|
_handler |
| Fields inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle |
|---|
_listeners, FAILED, RUNNING, STARTED, STARTING, STOPPED, STOPPING |
| Constructor Summary | |
|---|---|
Server()
|
|
Server(java.net.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. |
|
| Method Summary | |
|---|---|
boolean |
addBean(java.lang.Object o)
Add an associated bean. |
void |
addConnector(Connector connector)
|
void |
addLifeCycle(LifeCycle c)
Deprecated. 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(java.lang.Appendable out,
java.lang.String indent)
|
java.lang.Object |
getAttribute(java.lang.String name)
|
java.util.Enumeration |
getAttributeNames()
|
Connector[] |
getConnectors()
|
Container |
getContainer()
|
int |
getGracefulShutdown()
|
int |
getMaxCookieVersion()
Deprecated. |
boolean |
getSendDateHeader()
|
boolean |
getSendServerVersion()
|
SessionIdManager |
getSessionIdManager()
|
boolean |
getStopAtShutdown()
|
ThreadPool |
getThreadPool()
|
static java.lang.String |
getVersion()
|
void |
handle(AbstractHttpConnection connection)
|
void |
handleAsync(AbstractHttpConnection connection)
|
boolean |
isDumpAfterStart()
|
boolean |
isDumpBeforeStop()
|
boolean |
isUncheckedPrintWriter()
|
void |
join()
|
static void |
main(java.lang.String... args)
|
void |
removeAttribute(java.lang.String name)
|
boolean |
removeBean(java.lang.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)
Deprecated. Use removeBean(Object) |
void |
setAttribute(java.lang.String name,
java.lang.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)
Deprecated. |
void |
setSendDateHeader(boolean sendDateHeader)
|
void |
setSendServerVersion(boolean sendServerVersion)
|
void |
setSessionIdManager(SessionIdManager sessionIdManager)
|
void |
setStopAtShutdown(boolean stop)
|
void |
setThreadPool(ThreadPool threadPool)
|
void |
setUncheckedPrintWriter(boolean unchecked)
|
java.lang.String |
toString()
|
| Methods inherited from class org.eclipse.jetty.server.handler.HandlerWrapper |
|---|
destroy, expandChildren, getHandler, getHandlers, getNestedHandlerByClass, handle, setHandler, setServer |
| Methods inherited from class org.eclipse.jetty.server.handler.AbstractHandlerContainer |
|---|
expandHandler, findContainerOf, getChildHandlerByClass, getChildHandlers, getChildHandlersByClass |
| Methods inherited from class org.eclipse.jetty.server.handler.AbstractHandler |
|---|
dumpThis, getServer |
| Methods inherited from class org.eclipse.jetty.util.component.AggregateLifeCycle |
|---|
addBean, contains, dump, dump, dump, dump, dumpObject, dumpStdErr, getBean, getBeans, getBeans, isManaged, manage, removeBeans, unmanage |
| Methods inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle |
|---|
addLifeCycleListener, getState, getState, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.eclipse.jetty.util.component.LifeCycle |
|---|
addLifeCycleListener, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop |
| Constructor Detail |
|---|
public Server()
public Server(int port)
SelectChannelConnector at the passed port.
public Server(java.net.InetSocketAddress addr)
SelectChannelConnector at the passed address.
| Method Detail |
|---|
public static java.lang.String getVersion()
public Container getContainer()
public boolean getStopAtShutdown()
public void setStopAtShutdown(boolean stop)
public Connector[] getConnectors()
public void addConnector(Connector connector)
public void removeConnector(Connector connector)
getConnectors() and setConnectors(Connector[]) to
remove a connector.
connector - The connector to remove.public void setConnectors(Connector[] connectors)
connectors - The connectors to set.public ThreadPool getThreadPool()
public void setThreadPool(ThreadPool threadPool)
threadPool - The threadPool to set.public boolean isDumpAfterStart()
AggregateLifeCycle.dumpStdErr() is called after startingpublic void setDumpAfterStart(boolean dumpAfterStart)
dumpAfterStart - true if AggregateLifeCycle.dumpStdErr() is called after startingpublic boolean isDumpBeforeStop()
AggregateLifeCycle.dumpStdErr() is called before stoppingpublic void setDumpBeforeStop(boolean dumpBeforeStop)
dumpBeforeStop - true if AggregateLifeCycle.dumpStdErr() is called before stopping
protected void doStart()
throws java.lang.Exception
AggregateLifeCycle
doStart in class HandlerWrapperjava.lang.ExceptionAbstractLifeCycle.doStart()
protected void doStop()
throws java.lang.Exception
AggregateLifeCycle
doStop in class HandlerWrapperjava.lang.ExceptionAbstractLifeCycle.doStart()
public void handle(AbstractHttpConnection connection)
throws java.io.IOException,
javax.servlet.ServletException
java.io.IOException
javax.servlet.ServletException
public void handleAsync(AbstractHttpConnection connection)
throws java.io.IOException,
javax.servlet.ServletException
java.io.IOException
javax.servlet.ServletException
public void join()
throws java.lang.InterruptedException
java.lang.InterruptedExceptionpublic SessionIdManager getSessionIdManager()
public void setSessionIdManager(SessionIdManager sessionIdManager)
sessionIdManager - The sessionIdManager to set.public void setSendServerVersion(boolean sendServerVersion)
public boolean getSendServerVersion()
public void setSendDateHeader(boolean sendDateHeader)
sendDateHeader - public boolean getSendDateHeader()
@Deprecated public int getMaxCookieVersion()
@Deprecated public void setMaxCookieVersion(int maxCookieVersion)
@Deprecated public void addLifeCycle(LifeCycle c)
addBean(Object)
c - public boolean addBean(java.lang.Object o)
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.
addBean in class AggregateLifeCycleo - the bean object to add
@Deprecated public void removeLifeCycle(LifeCycle c)
removeBean(Object)
public boolean removeBean(java.lang.Object o)
removeBean in class AggregateLifeCyclepublic void clearAttributes()
clearAttributes in interface Attributespublic java.lang.Object getAttribute(java.lang.String name)
getAttribute in interface Attributespublic java.util.Enumeration getAttributeNames()
getAttributeNames in interface Attributespublic void removeAttribute(java.lang.String name)
removeAttribute in interface Attributes
public void setAttribute(java.lang.String name,
java.lang.Object attribute)
setAttribute in interface Attributespublic int getGracefulShutdown()
public void setGracefulShutdown(int timeoutMS)
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.public java.lang.String toString()
toString in class java.lang.Object
public void dump(java.lang.Appendable out,
java.lang.String indent)
throws java.io.IOException
dump in interface Dumpabledump in class AbstractHandlerContainerjava.io.IOExceptionpublic boolean isUncheckedPrintWriter()
public void setUncheckedPrintWriter(boolean unchecked)
public static void main(java.lang.String... args)
throws java.lang.Exception
java.lang.Exception
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||