Handler
, HandlerContainer
, org.eclipse.jetty.util.Attributes
, org.eclipse.jetty.util.component.Destroyable
, org.eclipse.jetty.util.component.LifeCycle
@ManagedObject("Jetty HTTP Servlet server") public class Server extends HandlerWrapper implements org.eclipse.jetty.util.Attributes
AbstractHandler.ErrorDispatchHandler
org.eclipse.jetty.util.component.AbstractLifeCycle.AbstractLifeCycleListener
FAILED, RUNNING, STARTED, STARTING, STOPPED, STOPPING
_handler
Constructor | Description |
---|---|
Server() |
|
Server(int port) |
Convenience constructor
Creates server and a
ServerConnector at the passed port. |
Server(java.net.InetSocketAddress addr) |
Convenience constructor
|
Server(org.eclipse.jetty.util.thread.ThreadPool pool) |
Modifier and Type | Method | Description |
---|---|---|
void |
addConnector(Connector connector) |
|
void |
clearAttributes() |
|
protected void |
doStart() |
|
protected void |
doStop() |
|
void |
dump(java.lang.Appendable out,
java.lang.String indent) |
|
java.lang.Object |
getAttribute(java.lang.String name) |
|
java.util.Enumeration<java.lang.String> |
getAttributeNames() |
|
Connector[] |
getConnectors() |
|
org.eclipse.jetty.http.HttpField |
getDateField() |
|
ErrorHandler |
getErrorHandler() |
|
RequestLog |
getRequestLog() |
|
SessionIdManager |
getSessionIdManager() |
|
boolean |
getStopAtShutdown() |
|
org.eclipse.jetty.util.thread.ThreadPool |
getThreadPool() |
|
java.net.URI |
getURI() |
|
static java.lang.String |
getVersion() |
|
void |
handle(HttpChannel channel) |
|
void |
handleAsync(HttpChannel channel) |
|
protected void |
handleOptions(Request request,
Response response) |
|
boolean |
isDumpAfterStart() |
|
boolean |
isDumpBeforeStop() |
|
void |
join() |
|
static void |
main(java.lang.String... args) |
|
void |
removeAttribute(java.lang.String name) |
|
void |
removeConnector(Connector connector) |
Convenience method which calls
getConnectors() and setConnectors(Connector[]) to
remove a connector. |
void |
setAttribute(java.lang.String name,
java.lang.Object attribute) |
|
void |
setConnectors(Connector[] connectors) |
Set the connectors for this server.
|
void |
setDumpAfterStart(boolean dumpAfterStart) |
|
void |
setDumpBeforeStop(boolean dumpBeforeStop) |
|
void |
setErrorHandler(ErrorHandler errorHandler) |
|
void |
setRequestLog(RequestLog requestLog) |
|
void |
setSessionIdManager(SessionIdManager sessionIdManager) |
|
void |
setStopAtShutdown(boolean stop) |
Set stop server at shutdown behaviour.
|
void |
setStopTimeout(long stopTimeout) |
Set a graceful stop time.
|
protected void |
start(org.eclipse.jetty.util.component.LifeCycle l) |
|
java.lang.String |
toString() |
doError, dumpThis, getServer
expandHandler, findContainerOf, getChildHandlerByClass, getChildHandlers, getChildHandlersByClass, setServer
addLifeCycleListener, getState, getState, getStopTimeout, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop
addBean, addBean, addBean, addEventListener, addManaged, contains, dump, dump, dump, dump, dumpBeans, dumpObject, dumpStdErr, getBean, getBeans, getBeans, getContainedBeans, getContainedBeans, isManaged, manage, removeBean, removeBeans, removeEventListener, setBeans, stop, unmanage, updateBean, updateBean, updateBeans
destroy, expandChildren, getHandler, getHandlers, handle, insertHandler, setHandler
public Server()
public Server(@Name("port") int port)
ServerConnector
at the passed port.port
- The port of a network HTTP connector (or 0 for a randomly allocated port).NetworkConnector.getLocalPort()
public Server(@Name("address") java.net.InetSocketAddress addr)
Creates server and a ServerConnector
at the passed address.
addr
- the inet socket address to create the connector frompublic Server(@Name("threadpool") org.eclipse.jetty.util.thread.ThreadPool pool)
public RequestLog getRequestLog()
public ErrorHandler getErrorHandler()
public void setRequestLog(RequestLog requestLog)
public void setErrorHandler(ErrorHandler errorHandler)
@ManagedAttribute("version of this server") public static java.lang.String getVersion()
public boolean getStopAtShutdown()
public void setStopTimeout(long stopTimeout)
StatisticsHandler
must be configured so that open connections can
be tracked for a graceful shutdown.setStopTimeout
in class org.eclipse.jetty.util.component.ContainerLifeCycle
ContainerLifeCycle.setStopTimeout(long)
public void setStopAtShutdown(boolean stop)
stop
- If true, this server instance will be explicitly stopped when the
JVM is shutdown. Otherwise the JVM is stopped with the server running.Runtime.addShutdownHook(Thread)
,
ShutdownThread
@ManagedAttribute(value="connectors for this server", readonly=true) 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("the server thread pool") public org.eclipse.jetty.util.thread.ThreadPool getThreadPool()
@ManagedAttribute("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("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 stoppingpublic org.eclipse.jetty.http.HttpField getDateField()
protected void doStart() throws java.lang.Exception
doStart
in class AbstractHandler
java.lang.Exception
protected void start(org.eclipse.jetty.util.component.LifeCycle l) throws java.lang.Exception
start
in class org.eclipse.jetty.util.component.ContainerLifeCycle
java.lang.Exception
protected void doStop() throws java.lang.Exception
doStop
in class AbstractHandler
java.lang.Exception
public void handle(HttpChannel channel) throws java.io.IOException, ServletException
java.io.IOException
ServletException
protected void handleOptions(Request request, Response response) throws java.io.IOException
java.io.IOException
public void handleAsync(HttpChannel channel) throws java.io.IOException, ServletException
java.io.IOException
ServletException
public void join() throws java.lang.InterruptedException
java.lang.InterruptedException
public SessionIdManager getSessionIdManager()
public void setSessionIdManager(SessionIdManager sessionIdManager)
sessionIdManager
- The sessionIdManager to set.public void clearAttributes()
clearAttributes
in interface org.eclipse.jetty.util.Attributes
public java.lang.Object getAttribute(java.lang.String name)
getAttribute
in interface org.eclipse.jetty.util.Attributes
public java.util.Enumeration<java.lang.String> getAttributeNames()
getAttributeNames
in interface org.eclipse.jetty.util.Attributes
public void removeAttribute(java.lang.String name)
removeAttribute
in interface org.eclipse.jetty.util.Attributes
public void setAttribute(java.lang.String name, java.lang.Object attribute)
setAttribute
in interface org.eclipse.jetty.util.Attributes
public java.net.URI getURI()
NetworkConnector
and first ContextHandler
, or nullpublic java.lang.String toString()
toString
in class java.lang.Object
public void dump(java.lang.Appendable out, java.lang.String indent) throws java.io.IOException
dump
in class org.eclipse.jetty.util.component.ContainerLifeCycle
java.io.IOException
public static void main(java.lang.String... args) throws java.lang.Exception
java.lang.Exception
Copyright © 1995–2018 Webtide. All rights reserved.