@ManagedObject(value="Jetty HTTP Servlet server") public class Server extends HandlerWrapper implements Attributes
AbstractHandler.ErrorDispatchHandlerAbstractLifeCycle.AbstractLifeCycleListenerLifeCycle.ListenerContainer.InheritedListener, Container.Listener| Constructor and Description |
|---|
Server() |
Server(InetSocketAddress addr)
Convenience constructor
|
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() |
void |
dump(Appendable out,
String indent)
Dump this object (and children) into an Appendable using the provided indent after any new lines.
|
Object |
getAttribute(String name) |
Enumeration<String> |
getAttributeNames() |
Connector[] |
getConnectors() |
HttpField |
getDateField() |
ErrorHandler |
getErrorHandler() |
RequestLog |
getRequestLog() |
SessionIdManager |
getSessionIdManager() |
boolean |
getStopAtShutdown() |
ThreadPool |
getThreadPool() |
URI |
getURI() |
static String |
getVersion() |
void |
handle(HttpChannel channel) |
void |
handleAsync(HttpChannel channel) |
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 |
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.
|
String |
toString() |
destroy, getHandler, getHandlers, handle, insertHandler, setHandlerfindContainerOf, getChildHandlerByClass, getChildHandlers, getChildHandlersByClass, setServergetServeraddBean, addBean, addEventListener, addManaged, contains, dump, dump, dump, dump, dumpObject, dumpStdErr, getBean, getBeans, getBeans, getContainedBeans, isAuto, isManaged, isUnmanaged, manage, removeBean, removeBeans, removeEventListener, setBeans, unmanage, updateBean, updateBean, updateBeansaddLifeCycleListener, getState, getState, getStopTimeout, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stopequals, getClass, hashCode, notify, notifyAll, wait, wait, waitaddLifeCycleListener, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, start, stop, stopdumpContainer, dumpIterable, dumpMapEntries, dumpObjects, dumpSelf, namedpublic Server()
public Server(@Name(value="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(value="address") InetSocketAddress addr)
Creates server and a ServerConnector at the passed address.
addr - the inet socket address to create the connector frompublic Server(@Name(value="threadpool") ThreadPool pool)
public RequestLog getRequestLog()
public ErrorHandler getErrorHandler()
public void setRequestLog(RequestLog requestLog)
public void setErrorHandler(ErrorHandler errorHandler)
@ManagedAttribute(value="version of this server") public static 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 ContainerLifeCycleContainerLifeCycle.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(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 stoppingpublic HttpField getDateField()
public void handle(HttpChannel channel) throws IOException, ServletException
IOExceptionServletExceptionpublic void handleAsync(HttpChannel channel) throws IOException, ServletException
IOExceptionServletExceptionpublic void join()
throws InterruptedException
InterruptedExceptionpublic SessionIdManager getSessionIdManager()
public void setSessionIdManager(SessionIdManager sessionIdManager)
sessionIdManager - The sessionIdManager to set.public void clearAttributes()
clearAttributes in interface Attributespublic Object getAttribute(String name)
getAttribute in interface Attributespublic Enumeration<String> getAttributeNames()
getAttributeNames in interface Attributespublic void removeAttribute(String name)
removeAttribute in interface Attributespublic void setAttribute(String name, Object attribute)
setAttribute in interface Attributespublic URI getURI()
NetworkConnector and first ContextHandler, or nullpublic String toString()
toString in class AbstractLifeCyclepublic void dump(Appendable out, String indent) throws IOException
Dumpabledump in interface Dumpabledump in class ContainerLifeCycleout - The appendable to dump toindent - The indent to apply after any new lines.IOException - if unable to write to AppendableCopyright © 2010 - 2020 Adobe. All Rights Reserved