Top Inners Fields Constructors Methods
org.eclipse.jetty.server

public Class Server

extends Wrapper
implements Attributes
Class Inheritance
All Implemented Interfaces
org.eclipse.jetty.util.Attributes
Annotations
@ManagedObject
Imports
java.io.File, .IOException, java.net.InetAddress, .InetSocketAddress, .URI, .URL, java.util.ArrayList, .Arrays, .Collections, .List, .Objects, .Optional, .Set, java.util.concurrent.CopyOnWriteArrayList, .TimeUnit, org.eclipse.jetty.http.DateGenerator, .HttpField, .HttpHeader, .MimeTypes, org.eclipse.jetty.io.ArrayByteBufferPool, .ByteBufferPool, .Connection, org.eclipse.jetty.server.handler.ContextHandler, .ErrorHandler, org.eclipse.jetty.server.internal.ResponseHttpFields, org.eclipse.jetty.util.Attributes, .Callback, .DecoratedObjectFactory, .ExceptionUtil, .IO, .Jetty, .NanoTime, .Uptime, org.eclipse.jetty.util.annotation.ManagedAttribute, .ManagedObject, .Name, org.eclipse.jetty.util.component.AttributeContainerMap, .ClassLoaderDump, .DumpableAttributes, .DumpableCollection, .Environment, .Graceful, .LifeCycle, org.eclipse.jetty.util.resource.FileSystemPool, .Resource, .ResourceFactory, org.eclipse.jetty.util.thread.AutoLock, .Invocable, .QueuedThreadPool, .ScheduledExecutorScheduler, .Scheduler, .ShutdownThread, .ThreadPool, org.slf4j.Logger, .LoggerFactory

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
private static class
pack-priv class

Field Summary

Modifier and TypeField and Description
private static final String
private final AttributeContainerMap
private final ByteBufferPool
private final List<Connector>
private volatile Server.DateField
private final AutoLock
private Handler
private boolean
private boolean
private boolean
private Request.Handler
private Invocable.InvocationType
private final MimeTypes.Mutable
private RequestLog
private final Scheduler
private final Context
private String
private boolean
private long
private File
private final ThreadPool
private static final Logger

Constructor Summary

AccessConstructor and Description
public
public
Server(int
The port of a network HTTP connector (or 0 for a randomly allocated port).
port
)

Convenience constructor Creates server and a ServerConnector at the passed port.

public
Server(InetSocketAddress
the inet socket address to create the connector from
addr
)

Convenience constructor

Creates server and a ServerConnector at the passed address.

public
public
Server(ThreadPool threadPool, Scheduler scheduler, ByteBufferPool bufferPool)

Method Summary

Modifier and TypeMethod and Description
public void
addBeanToAllConnectors(Object
the bean to be added.
bean
)

Add a bean to all connectors on the server.

public void
public void
clearAttributes()

Overrides default org.eclipse.jetty.util.Attributes.clearAttributes.

Clear all attribute names
protected void
doStart()

Overrides org.eclipse.jetty.server.Handler.Abstract.doStart.

Starts the managed lifecycle beans in the order they were added.
protected void
doStop()

Overrides org.eclipse.jetty.server.Handler.Abstract.doStop.

Stops the managed lifecycle beans in the reverse order they were added.
public void
dump(Appendable
The appendable to dump to
out
,
String
The indent to apply after any new lines.
indent
)

Overrides org.eclipse.jetty.util.component.ContainerLifeCycle.dump.

Implements org.eclipse.jetty.util.component.Dumpable.dump.

Dump this object (and children) into an Appendable using the provided indent after any new lines.
public Object
getAttribute(String
the attribute to get
name
)

Implements org.eclipse.jetty.util.Attributes.getAttribute.

Get an attribute
public Set<String>
getAttributeNameSet()

Implements org.eclipse.jetty.util.Attributes.getAttributeNameSet.

Get the immutable set of attribute names.
public ByteBufferPool
public Connector[]

Returns:

Returns the connectors.
getConnectors
()

public Context
getContext()

Get the Context associated with all Requests prior to being handled by a ContextHandler.

public HttpField

Returns:

A HttpField instance efficiently recording the current time to a second resolution, that cannot be cleared from a ResponseHttpFields instance.
getDateField
()

public Resource

Returns:

the default Favicon
getDefaultFavicon
()

Get the default Favicon

public Handler
public Resource

Returns:

the default CSS
getDefaultStyleSheet
()

Get the Default CSS

public Request.Handler
public Invocable.InvocationType
public MimeTypes.Mutable
public RequestLog
public Scheduler
public Server
public String
public boolean
public long
public File

Returns:

The server temporary directory if set, else null. To always obtain a non-null temporary directory use Context#getTempDirectory() on getContext().
getTempDirectory
()

public ThreadPool

Returns:

Returns the threadPool.
getThreadPool
()

public URI

Returns:

The URI of the first NetworkConnector and first ContextHandler, or null
getURI
()

public static String
public boolean
handle(Request
the HTTP request to handle
request
,
Response
the HTTP response to handle
response
,
Callback
the callback to complete when the handling is complete
callback
)

Overrides org.eclipse.jetty.server.Handler.Wrapper.handle.

Implements org.eclipse.jetty.server.Request.Handler.handle.

Invoked to handle the passed HTTP request and response.

public boolean
public boolean

Returns:

true if dumpStdErr() is called after starting
isDumpAfterStart
()

public boolean

Returns:

true if dumpStdErr() is called before stopping
isDumpBeforeStop
()

public void
join()

public static void
main(String... args)

private Resource

Returns:

the Resource found, or null if not found.
newResource
(String
the name of the resource (relative to `/org/eclipse/jetty/server/`)
name
)

Create a new Resource representing a resources that is managed by the Server.

public Object
removeAttribute(String
the attribute to remove
name
)

Implements org.eclipse.jetty.util.Attributes.removeAttribute.

Remove an attribute
public void
removeConnector(Connector
The connector to remove.
connector
)

Convenience method which calls getConnectors() and setConnectors(Connector[]) to remove a connector.

public Object
setAttribute(String
the attribute to set
name
,
Object
the value to set. A null value is equivalent to removing the attribute.
attribute
)

Implements org.eclipse.jetty.util.Attributes.setAttribute.

Set an attribute
public void
setConnectors(Connector[]
The connectors to set.
connectors
)

Set the connectors for this server.

public void
setDefaultHandler(Handler
The handler to use if no other handler is set or has handled the request. This handler should always accept the request, even if only to send a 404.
defaultHandler
)

public void
setDryRun(boolean dryRun)

public void
setDumpAfterStart(boolean
true if dumpStdErr() is called after starting
dumpAfterStart
)

Set true if dumpStdErr() is called after starting.

public void
setDumpBeforeStop(boolean
true if dumpStdErr() is called before stopping
dumpBeforeStop
)

Set true if dumpStdErr() is called before stopping.

public void
public void
public void
setServerInfo(String serverInfo)

public void
setStopAtShutdown(boolean
If true, this server instance will be explicitly stopped when the JVM is shutdown. Otherwise the JVM is stopped with the server running.
stop
)

Set stop server at shutdown behaviour.

public void
setStopTimeout(long stopTimeout)

public void
setTempDirectory(String
A string representation of the temporary directory.
temp
)

Convenience method to call setTempDirectory(File) from a String representation of the temporary directory.

public void
setTempDirectory(File
A directory that must exist and be writable or null to get the default.
temp
)

Set the temporary directory returned by Context#getTempDirectory() for the root Context returned getContext().

protected void
start(LifeCycle
the lifecycle to start
l
)

Overrides org.eclipse.jetty.util.component.ContainerLifeCycle.start.

Starts the given lifecycle.
public String
toString()

Overrides org.eclipse.jetty.util.component.AbstractLifeCycle.toString.

Returns a string representation of the object.
Inherited from org.eclipse.jetty.server.Handler.Wrapper:
getHandlersetHandler