|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.eclipse.jetty.util.component.AbstractLifeCycle 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 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(int port)
Convenience constructor Creates server and a SocketConnector at the passed port. |
Method Summary | ||
---|---|---|
void |
addBean(Object o)
Add an associated bean. |
|
void |
addConnector(Connector connector)
|
|
void |
addLifeCycle(LifeCycle c)
Deprecated. Use #addBean(LifeCycle) |
|
void |
clearAttributes()
|
|
protected void |
doStart()
|
|
protected void |
doStop()
|
|
Object |
getAttribute(String name)
|
|
Enumeration |
getAttributeNames()
|
|
|
getBeans(Class<T> clazz)
Get dependent beans of a specific class |
|
Connector[] |
getConnectors()
|
|
Container |
getContainer()
|
|
int |
getGracefulShutdown()
|
|
boolean |
getSendDateHeader()
|
|
boolean |
getSendServerVersion()
|
|
SessionIdManager |
getSessionIdManager()
|
|
boolean |
getStopAtShutdown()
|
|
ThreadPool |
getThreadPool()
|
|
static String |
getVersion()
|
|
void |
handle(HttpConnection connection)
|
|
void |
handleAsync(HttpConnection connection)
|
|
void |
join()
|
|
static void |
main(String[] args)
|
|
void |
removeAttribute(String name)
|
|
void |
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)
Deprecated. Use removeBean(Object) |
|
void |
setAttribute(String name,
Object attribute)
|
|
void |
setConnectors(Connector[] connectors)
Set the connectors for this server. |
|
void |
setGracefulShutdown(int timeoutMS)
Set graceful shutdown timeout. |
|
void |
setSendDateHeader(boolean sendDateHeader)
|
|
void |
setSendServerVersion(boolean sendServerVersion)
|
|
void |
setSessionIdManager(SessionIdManager sessionIdManager)
|
|
void |
setStopAtShutdown(boolean stop)
|
|
void |
setThreadPool(ThreadPool threadPool)
|
|
String |
toString()
|
Methods inherited from class org.eclipse.jetty.server.handler.HandlerWrapper |
---|
expandChildren, getHandler, getHandlers, handle, setHandler, setServer |
Methods inherited from class org.eclipse.jetty.server.handler.AbstractHandlerContainer |
---|
dump, expandHandler, getChildHandlerByClass, getChildHandlers, getChildHandlersByClass |
Methods inherited from class org.eclipse.jetty.server.handler.AbstractHandler |
---|
destroy, dump, getServer |
Methods inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle |
---|
addLifeCycleListener, 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)
SocketConnector
at the passed port.
Method Detail |
---|
public static 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.protected void doStart() throws Exception
doStart
in class HandlerWrapper
Exception
protected void doStop() throws Exception
doStop
in class HandlerWrapper
Exception
public void handle(HttpConnection connection) throws IOException, ServletException
IOException
ServletException
public void handleAsync(HttpConnection connection) throws IOException, ServletException
IOException
ServletException
public void join() throws InterruptedException
InterruptedException
public 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()
public void addLifeCycle(LifeCycle c)
#addBean(LifeCycle)
c
- public void addBean(Object o)
Container
and if it is a LifeCycle
instance, it will be
started/stopped along with the Server.
c
- public <T> List<T> getBeans(Class<T> clazz)
clazz
-
addBean(Object)
public void removeLifeCycle(LifeCycle c)
removeBean(Object)
public void removeBean(Object o)
public void clearAttributes()
clearAttributes
in interface Attributes
public Object getAttribute(String name)
getAttribute
in interface Attributes
public Enumeration getAttributeNames()
getAttributeNames
in interface Attributes
public void removeAttribute(String name)
removeAttribute
in interface Attributes
public void setAttribute(String name, Object attribute)
setAttribute
in interface Attributes
public int getGracefulShutdown()
public void setGracefulShutdown(int timeoutMS)
doStop()
method will not immediately stop the
server. Instead, all Connector
s 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 String toString()
toString
in class AbstractHandler
public static void main(String[] args)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |