public class Server extends HandlerWrapper implements Attributes
Modifier and Type | Class and Description |
---|---|
static interface |
Server.Graceful |
AbstractLifeCycle.AbstractLifeCycleListener
LifeCycle.Listener
_handler
_listeners, FAILED, RUNNING, STARTED, STARTING, STOPPED, STOPPING
Constructor and Description |
---|
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. |
Modifier and Type | Method and Description |
---|---|
boolean |
addBean(Object o)
Add an associated bean.
|
void |
addConnector(Connector connector) |
void |
addLifeCycle(LifeCycle c)
Deprecated.
Use
addBean(Object) |
void |
clearAttributes() |
protected void |
doStart() |
protected void |
doStop() |
void |
dump(Appendable out,
String indent) |
Object |
getAttribute(String name) |
Enumeration |
getAttributeNames() |
Connector[] |
getConnectors() |
Container |
getContainer() |
int |
getGracefulShutdown() |
int |
getMaxCookieVersion()
Deprecated.
|
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)
Deprecated.
|
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)
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) |
String |
toString() |
destroy, expandChildren, getHandler, getHandlers, getNestedHandlerByClass, handle, setHandler, setServer
expandHandler, findContainerOf, getChildHandlerByClass, getChildHandlers, getChildHandlersByClass
dumpThis, getServer
addBean, contains, dump, dump, dump, dump, dumpObject, dumpStdErr, getBean, getBeans, getBeans, isManaged, manage, removeBeans, unmanage
addLifeCycleListener, getState, getState, 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(int port)
SelectChannelConnector
at the passed port.public Server(InetSocketAddress addr)
SelectChannelConnector
at the passed address.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.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 stoppingprotected void doStart() throws Exception
doStart
in class HandlerWrapper
Exception
protected void doStop() throws Exception
doStop
in class HandlerWrapper
Exception
public void handle(AbstractHttpConnection connection) throws IOException, javax.servlet.ServletException
IOException
javax.servlet.ServletException
public void handleAsync(AbstractHttpConnection connection) throws IOException, javax.servlet.ServletException
IOException
javax.servlet.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()
@Deprecated public int getMaxCookieVersion()
@Deprecated public void setMaxCookieVersion(int maxCookieVersion)
@Deprecated public void addLifeCycle(LifeCycle c)
addBean(Object)
c
- public boolean addBean(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 AggregateLifeCycle
o
- the bean object to add@Deprecated public void removeLifeCycle(LifeCycle c)
removeBean(Object)
public boolean removeBean(Object o)
removeBean
in class AggregateLifeCycle
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 void dump(Appendable out, String indent) throws IOException
dump
in interface Dumpable
dump
in class AbstractHandlerContainer
IOException
public boolean isUncheckedPrintWriter()
public void setUncheckedPrintWriter(boolean unchecked)
Copyright © 1995-2012 Mort Bay Consulting. All Rights Reserved.