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, setServer
expandHandler, getChildHandlerByClass, getChildHandlers, getChildHandlersByClass
destroy, getServer, toString
addLifeCycleListener, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop
public 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 HandlerWrapper
Exception
protected void doStop() throws Exception
doStop
in class HandlerWrapper
Exception
public void handle(HttpConnection connection) throws IOException, ServletException
IOException
ServletException
public void join() throws InterruptedException
InterruptedException
public 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)
HandlerWrapper
addHandler
in interface HandlerContainer
addHandler
in class HandlerWrapper
public void removeHandler(Handler handler)
removeHandler
in interface HandlerContainer
removeHandler
in class HandlerWrapper
public Handler[] getHandlers()
public void setHandlers(Handler[] handlers)
public void clearAttributes()
clearAttributes
in interface org.mortbay.util.Attributes
public Object getAttribute(String name)
getAttribute
in interface org.mortbay.util.Attributes
public Enumeration getAttributeNames()
getAttributeNames
in interface org.mortbay.util.Attributes
public void removeAttribute(String name)
removeAttribute
in interface org.mortbay.util.Attributes
public void setAttribute(String name, Object attribute)
setAttribute
in interface org.mortbay.util.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.Copyright © 2009 Mortbay Consulting Pty. Ltd. All Rights Reserved.