public class Server extends HandlerWrapper implements org.mortbay.util.Attributes
| Modifier and Type | Class and Description |
|---|---|
static interface |
Server.Graceful |
| Modifier and Type | Field and Description |
|---|---|
static String |
SNAPSHOT_VERSION |
static String |
UNKNOWN_VERSION |
_string| Constructor and Description |
|---|
Server() |
Server(int port)
Convenience constructor
Creates server and a
SocketConnector at the passed port. |
| Modifier and Type | Method and Description |
|---|---|
void |
addConnector(Connector connector) |
void |
addHandler(Handler handler)
Add a handler.
|
void |
addLifeCycle(org.mortbay.component.LifeCycle c)
Add a LifeCycle object to be started/stopped
along with the Server.
|
void |
addUserRealm(UserRealm realm) |
void |
clearAttributes() |
protected void |
doStart() |
protected void |
doStop() |
Object |
getAttribute(String name) |
Enumeration |
getAttributeNames() |
Connector[] |
getConnectors() |
org.mortbay.component.Container |
getContainer() |
int |
getGracefulShutdown() |
Handler[] |
getHandlers() |
boolean |
getSendDateHeader() |
boolean |
getSendServerVersion() |
SessionIdManager |
getSessionIdManager() |
boolean |
getStopAtShutdown() |
org.mortbay.thread.ThreadPool |
getThreadPool() |
UserRealm[] |
getUserRealms() |
static String |
getVersion() |
void |
handle(HttpConnection connection) |
void |
join() |
void |
removeAttribute(String name) |
void |
removeConnector(Connector connector)
Conveniance method which calls
getConnectors() and setConnectors(Connector[]) to
remove a connector. |
void |
removeHandler(Handler handler) |
void |
removeLifeCycle(org.mortbay.component.LifeCycle c)
Remove a LifeCycle object to be started/stopped
along with the Server
|
void |
removeUserRealm(UserRealm realm) |
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 |
setHandlers(Handler[] handlers) |
void |
setSendDateHeader(boolean sendDateHeader) |
void |
setSendServerVersion(boolean sendServerVersion) |
void |
setSessionIdManager(SessionIdManager sessionIdManager) |
void |
setStopAtShutdown(boolean stop) |
void |
setThreadPool(org.mortbay.thread.ThreadPool threadPool) |
void |
setUserRealms(UserRealm[] realms) |
expandChildren, getHandler, handle, setHandler, setServerexpandHandler, getChildHandlerByClass, getChildHandlers, getChildHandlersByClassdestroy, getServer, toStringaddLifeCycleListener, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stoppublic static final String UNKNOWN_VERSION
public static final String SNAPSHOT_VERSION
public Server()
public Server(int port)
SocketConnector at the passed port.public static String getVersion()
public org.mortbay.component.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 org.mortbay.thread.ThreadPool getThreadPool()
public void setThreadPool(org.mortbay.thread.ThreadPool threadPool)
threadPool - The threadPool to set.protected void doStart()
throws Exception
doStart in class HandlerWrapperExceptionprotected void doStop()
throws Exception
doStop in class HandlerWrapperExceptionpublic void handle(HttpConnection connection) throws IOException, ServletException
IOExceptionServletExceptionpublic void join()
throws InterruptedException
InterruptedExceptionpublic UserRealm[] getUserRealms()
public void setUserRealms(UserRealm[] realms)
realms - Map of realm name to UserRealm instances.public void addUserRealm(UserRealm realm)
public void removeUserRealm(UserRealm realm)
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(org.mortbay.component.LifeCycle c)
c - public void removeLifeCycle(org.mortbay.component.LifeCycle c)
c - public void addHandler(Handler handler)
HandlerWrapperaddHandler in interface HandlerContaineraddHandler in class HandlerWrapperpublic void removeHandler(Handler handler)
removeHandler in interface HandlerContainerremoveHandler in class HandlerWrapperpublic Handler[] getHandlers()
public void setHandlers(Handler[] handlers)
public void clearAttributes()
clearAttributes in interface org.mortbay.util.Attributespublic Object getAttribute(String name)
getAttribute in interface org.mortbay.util.Attributespublic Enumeration getAttributeNames()
getAttributeNames in interface org.mortbay.util.Attributespublic void removeAttribute(String name)
removeAttribute in interface org.mortbay.util.Attributespublic void setAttribute(String name, Object attribute)
setAttribute in interface org.mortbay.util.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.Copyright © 2009 Mortbay Consulting Pty. Ltd. All Rights Reserved.