@ManagedObject(value="Jetty HTTP Servlet server") public class Server extends HandlerWrapper implements Attributes
AbstractLifeCycle.AbstractLifeCycleListener
LifeCycle.Listener
Container.InheritedListener, Container.Listener
_handler
Constructor and Description |
---|
Server() |
Server(InetSocketAddress addr)
Convenience constructor
Creates server and a
ServerConnector at the passed address. |
Server(int port)
Convenience constructor
Creates server and a
ServerConnector at the passed port. |
Server(ThreadPool pool) |
Modifier and Type | Method and Description |
---|---|
void |
addConnector(Connector connector) |
void |
clearAttributes() |
protected void |
doStart()
Starts the managed lifecycle beans in the order they were added.
|
protected void |
doStop()
Stops the managed lifecycle beans in the reverse order they were added.
|
void |
dump(Appendable out,
String indent) |
Object |
getAttribute(String name) |
Enumeration<String> |
getAttributeNames() |
Connector[] |
getConnectors() |
boolean |
getSendDateHeader() |
boolean |
getSendServerVersion() |
SessionIdManager |
getSessionIdManager() |
boolean |
getStopAtShutdown() |
ThreadPool |
getThreadPool() |
static String |
getVersion() |
void |
handle(HttpChannel<?> connection) |
void |
handleAsync(HttpChannel<?> connection) |
protected void |
handleOptions(Request request,
Response response) |
boolean |
isDumpAfterStart() |
boolean |
isDumpBeforeStop() |
void |
join() |
static void |
main(String... args) |
void |
removeAttribute(String name) |
void |
removeConnector(Connector connector)
Convenience method which calls
getConnectors() and setConnectors(Connector[]) to
remove a connector. |
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 |
setSendDateHeader(boolean sendDateHeader) |
void |
setSendServerVersion(boolean sendServerVersion) |
void |
setSessionIdManager(SessionIdManager sessionIdManager) |
void |
setStopAtShutdown(boolean stop) |
String |
toString() |
destroy, expandChildren, getHandler, getHandlers, getNestedHandlerByClass, handle, setHandler, setServer
expandHandler, findContainerOf, getChildHandlerByClass, getChildHandlers, getChildHandlersByClass
dumpThis, getServer
addBean, addBean, addBean, contains, dump, dump, dump, dump, dumpBeans, dumpObject, dumpStdErr, getBean, getBeans, getBeans, isManaged, manage, removeBean, removeBeans, setStopTimeout, unmanage, updateBean, updateBeans
addLifeCycleListener, getState, getState, getStopTimeout, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
addLifeCycleListener, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop
public Server()
public Server(@Name(value="port") int port)
ServerConnector
at the passed port.public Server(@Name(value="address") InetSocketAddress addr)
ServerConnector
at the passed address.public Server(@Name(value="threadpool") ThreadPool pool)
@ManagedAttribute(value="version of this server") public static String getVersion()
public boolean getStopAtShutdown()
public void setStopAtShutdown(boolean stop)
@ManagedAttribute(value="connectors for this server") 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.@ManagedAttribute(value="the server thread pool") public ThreadPool getThreadPool()
@ManagedAttribute(value="dump state to stderr after start") public boolean isDumpAfterStart()
ContainerLifeCycle.dumpStdErr()
is called after startingpublic void setDumpAfterStart(boolean dumpAfterStart)
dumpAfterStart
- true if ContainerLifeCycle.dumpStdErr()
is called after starting@ManagedAttribute(value="dump state to stderr before stop") public boolean isDumpBeforeStop()
ContainerLifeCycle.dumpStdErr()
is called before stoppingpublic void setDumpBeforeStop(boolean dumpBeforeStop)
dumpBeforeStop
- true if ContainerLifeCycle.dumpStdErr()
is called before stoppingprotected void doStart() throws Exception
ContainerLifeCycle
doStart
in class AbstractHandler
Exception
protected void doStop() throws Exception
ContainerLifeCycle
doStop
in class AbstractHandler
Exception
public void handle(HttpChannel<?> connection) throws IOException, ServletException
IOException
ServletException
protected void handleOptions(Request request, Response response) throws IOException
IOException
public void handleAsync(HttpChannel<?> 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)
@ManagedAttribute(value="if true, include the server version in HTTP headers") public boolean getSendServerVersion()
public void setSendDateHeader(boolean sendDateHeader)
@ManagedAttribute(value="if true, include the date in HTTP headers") public boolean getSendDateHeader()
public void clearAttributes()
clearAttributes
in interface Attributes
public Object getAttribute(String name)
getAttribute
in interface Attributes
public Enumeration<String> 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 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 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 void dump(Appendable out, String indent) throws IOException
dump
in interface Dumpable
dump
in class ContainerLifeCycle
IOException
Copyright © 1995-2012 Mort Bay Consulting. All Rights Reserved.