464727 - Update Javadoc for Java 8 DocLint

+ Fixing javadoc in jetty-server
This commit is contained in:
Joakim Erdfelt 2015-04-21 13:58:42 -07:00
parent 9983f4680e
commit 5bdfd53e9c
43 changed files with 305 additions and 284 deletions

View File

@ -53,7 +53,7 @@ import org.eclipse.jetty.util.thread.Scheduler;
/** /**
* <p>An abstract implementation of {@link Connector} that provides a {@link ConnectionFactory} mechanism * <p>An abstract implementation of {@link Connector} that provides a {@link ConnectionFactory} mechanism
* for creating {@link Connection} instances for various protocols (HTTP, SSL, etc).</p> * for creating {@link org.eclipse.jetty.io.Connection} instances for various protocols (HTTP, SSL, etc).</p>
* *
* <h2>Connector Services</h2> * <h2>Connector Services</h2>
* The abstract connector manages the dependent services needed by all specific connector instances: * The abstract connector manages the dependent services needed by all specific connector instances:
@ -79,7 +79,7 @@ import org.eclipse.jetty.util.thread.Scheduler;
* an {@link SslConnectionFactory} that has been instantiated with the {@link HttpConnectionFactory} as it's * an {@link SslConnectionFactory} that has been instantiated with the {@link HttpConnectionFactory} as it's
* next protocol. * next protocol.
* *
* <h4>Configuring Connection Factories</h4> * <h2>Configuring Connection Factories</h2>
* The collection of available {@link ConnectionFactory} may be constructor injected or modified with the * The collection of available {@link ConnectionFactory} may be constructor injected or modified with the
* methods {@link #addConnectionFactory(ConnectionFactory)}, {@link #removeConnectionFactory(String)} and * methods {@link #addConnectionFactory(ConnectionFactory)}, {@link #removeConnectionFactory(String)} and
* {@link #setConnectionFactories(Collection)}. Only a single {@link ConnectionFactory} instance may be configured * {@link #setConnectionFactories(Collection)}. Only a single {@link ConnectionFactory} instance may be configured
@ -94,20 +94,20 @@ import org.eclipse.jetty.util.thread.Scheduler;
* (or other factories that can also provide HTTP Semantics). Similarly the {@link SslConnectionFactory} is * (or other factories that can also provide HTTP Semantics). Similarly the {@link SslConnectionFactory} is
* configured by passing it a {@link SslContextFactory} and a next protocol name. * configured by passing it a {@link SslContextFactory} and a next protocol name.
* *
* <h4>Connection Factory Operation</h4> * <h2>Connection Factory Operation</h2>
* {@link ConnectionFactory}s may simply create a {@link Connection} instance to support a specific * {@link ConnectionFactory}s may simply create a {@link org.eclipse.jetty.io.Connection} instance to support a specific
* protocol. For example, the {@link HttpConnectionFactory} will create a {@link HttpConnection} instance * protocol. For example, the {@link HttpConnectionFactory} will create a {@link HttpConnection} instance
* that can handle http/1.1, http/1.0 and http/0.9. * that can handle http/1.1, http/1.0 and http/0.9.
* <p> * <p>
* {@link ConnectionFactory}s may also create a chain of {@link Connection} instances, using other {@link ConnectionFactory} instances. * {@link ConnectionFactory}s may also create a chain of {@link org.eclipse.jetty.io.Connection} instances, using other {@link ConnectionFactory} instances.
* For example, the {@link SslConnectionFactory} is configured with a next protocol name, so that once it has accepted * For example, the {@link SslConnectionFactory} is configured with a next protocol name, so that once it has accepted
* a connection and created an {@link SslConnection}, it then used the next {@link ConnectionFactory} from the * a connection and created an {@link SslConnection}, it then used the next {@link ConnectionFactory} from the
* connector using the {@link #getConnectionFactory(String)} method, to create a {@link Connection} instance that * connector using the {@link #getConnectionFactory(String)} method, to create a {@link org.eclipse.jetty.io.Connection} instance that
* will handle the unecrypted bytes from the {@link SslConnection}. If the next protocol is "http/1.1", then the * will handle the unencrypted bytes from the {@link SslConnection}. If the next protocol is "http/1.1", then the
* {@link SslConnectionFactory} will have a protocol name of "SSL-http/1.1" and lookup "http/1.1" for the protocol * {@link SslConnectionFactory} will have a protocol name of "SSL-http/1.1" and lookup "http/1.1" for the protocol
* to run over the SSL connection. * to run over the SSL connection.
* <p> * <p>
* {@link ConnectionFactory}s may also create temporary {@link Connection} instances that will exchange bytes * {@link ConnectionFactory}s may also create temporary {@link org.eclipse.jetty.io.Connection} instances that will exchange bytes
* over the connection to determine what is the next protocol to use. For example the ALPN protocol is an extension * over the connection to determine what is the next protocol to use. For example the ALPN protocol is an extension
* of SSL to allow a protocol to be specified during the SSL handshake. ALPN is used by the HTTP/2 protocol to * of SSL to allow a protocol to be specified during the SSL handshake. ALPN is used by the HTTP/2 protocol to
* negotiate the protocol that the client and server will speak. Thus to accept a HTTP/2 connection, the * negotiate the protocol that the client and server will speak. Thus to accept a HTTP/2 connection, the
@ -118,18 +118,17 @@ import org.eclipse.jetty.util.thread.Scheduler;
* could be "h2" or the default of "http/1.1". Once the next protocol is determined, the ALPN connection * could be "h2" or the default of "http/1.1". Once the next protocol is determined, the ALPN connection
* calls {@link #getConnectionFactory(String)} to create a connection instance that will replace the ALPN connection as * calls {@link #getConnectionFactory(String)} to create a connection instance that will replace the ALPN connection as
* the connection chained to the SSL connection. * the connection chained to the SSL connection.
* <p>
* <h2>Acceptors</h2> * <h2>Acceptors</h2>
* The connector will execute a number of acceptor tasks to the {@link Exception} service passed to the constructor. * The connector will execute a number of acceptor tasks to the {@link Exception} service passed to the constructor.
* The acceptor tasks run in a loop while the connector is running and repeatedly call the abstract {@link #accept(int)} method. * The acceptor tasks run in a loop while the connector is running and repeatedly call the abstract {@link #accept(int)} method.
* The implementation of the accept method must: * The implementation of the accept method must:
* <nl> * <ol>
* <li>block waiting for new connections * <li>block waiting for new connections</li>
* <li>accept the connection (eg socket accept) * <li>accept the connection (eg socket accept)</li>
* <li>perform any configuration of the connection (eg. socket linger times) * <li>perform any configuration of the connection (eg. socket linger times)</li>
* <li>call the {@link #getDefaultConnectionFactory()} {@link ConnectionFactory#newConnection(Connector, org.eclipse.jetty.io.EndPoint)} * <li>call the {@link #getDefaultConnectionFactory()} {@link ConnectionFactory#newConnection(Connector, org.eclipse.jetty.io.EndPoint)}
* method to create a new Connection instance. * method to create a new Connection instance.</li>
* </nl> * </ol>
* The default number of acceptor tasks is the minimum of 1 and half the number of available CPUs. Having more acceptors may reduce * The default number of acceptor tasks is the minimum of 1 and half the number of available CPUs. Having more acceptors may reduce
* the latency for servers that see a high rate of new connections (eg HTTP/1.0 without keep-alive). Typically the default is * the latency for servers that see a high rate of new connections (eg HTTP/1.0 without keep-alive). Typically the default is
* sufficient for modern persistent protocols (HTTP/1.1, HTTP/2 etc.) * sufficient for modern persistent protocols (HTTP/1.1, HTTP/2 etc.)
@ -464,7 +463,7 @@ public abstract class AbstractConnector extends ContainerLifeCycle implements Co
* Typically this would be used to lower the priority to give preference * Typically this would be used to lower the priority to give preference
* to handling previously accepted connections rather than accepting * to handling previously accepted connections rather than accepting
* new connections</p> * new connections</p>
* @param acceptorPriorityDelta * @param acceptorPriorityDelta the acceptor priority delta
*/ */
public void setAcceptorPriorityDelta(int acceptorPriorityDelta) public void setAcceptorPriorityDelta(int acceptorPriorityDelta)
{ {

View File

@ -68,6 +68,7 @@ public abstract class AbstractNCSARequestLog extends AbstractLifeCycle implement
/** /**
* Is logging enabled * Is logging enabled
* @return true if logging is enabled
*/ */
protected abstract boolean isEnabled(); protected abstract boolean isEnabled();
@ -75,6 +76,8 @@ public abstract class AbstractNCSARequestLog extends AbstractLifeCycle implement
/** /**
* Write requestEntry out. (to disk or slf4j log) * Write requestEntry out. (to disk or slf4j log)
* @param requestEntry the request entry
* @throws IOException if unable to write the entry
*/ */
public abstract void write(String requestEntry) throws IOException; public abstract void write(String requestEntry) throws IOException;
@ -224,7 +227,7 @@ public abstract class AbstractNCSARequestLog extends AbstractLifeCycle implement
* *
* @param request request object * @param request request object
* @param b StringBuilder to write to * @param b StringBuilder to write to
* @throws IOException * @throws IOException if unable to log the extended information
*/ */
protected void logExtended(Request request, protected void logExtended(Request request,
StringBuilder b) throws IOException StringBuilder b) throws IOException
@ -334,15 +337,19 @@ public abstract class AbstractNCSARequestLog extends AbstractLifeCycle implement
} }
/** /**
* @param value true to log dispatch
* @deprecated use {@link StatisticsHandler} * @deprecated use {@link StatisticsHandler}
*/ */
@Deprecated
public void setLogDispatch(boolean value) public void setLogDispatch(boolean value)
{ {
} }
/** /**
* @return true if logging dispatches
* @deprecated use {@link StatisticsHandler} * @deprecated use {@link StatisticsHandler}
*/ */
@Deprecated
public boolean isLogDispatch() public boolean isLogDispatch()
{ {
return false; return false;

View File

@ -24,14 +24,12 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
/* ------------------------------------------------------------ */
/** The Authentication state of a request. /** The Authentication state of a request.
* <p> * <p>
* The Authentication state can be one of several sub-types that * The Authentication state can be one of several sub-types that
* reflects where the request is in the many different authentication * reflects where the request is in the many different authentication
* cycles. Authentication might not yet be checked or it might be checked * cycles. Authentication might not yet be checked or it might be checked
* and failed, checked and deferred or succeeded. * and failed, checked and deferred or succeeded.
*
*/ */
public interface Authentication public interface Authentication
{ {
@ -75,6 +73,7 @@ public interface Authentication
/** Authenticate if possible without sending a challenge. /** Authenticate if possible without sending a challenge.
* This is used to check credentials that have been sent for * This is used to check credentials that have been sent for
* non-manditory authentication. * non-manditory authentication.
* @param request the request
* @return The new Authentication state. * @return The new Authentication state.
*/ */
Authentication authenticate(ServletRequest request); Authentication authenticate(ServletRequest request);
@ -83,6 +82,8 @@ public interface Authentication
/** Authenticate and possibly send a challenge. /** Authenticate and possibly send a challenge.
* This is used to initiate authentication for previously * This is used to initiate authentication for previously
* non-manditory authentication. * non-manditory authentication.
* @param request the request
* @param response the response
* @return The new Authentication state. * @return The new Authentication state.
*/ */
Authentication authenticate(ServletRequest request,ServletResponse response); Authentication authenticate(ServletRequest request,ServletResponse response);
@ -90,8 +91,9 @@ public interface Authentication
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */
/** Login with the LOGIN authenticator /** Login with the LOGIN authenticator
* @param username * @param username the username
* @param password * @param password the password
* @param request the request
* @return The new Authentication state * @return The new Authentication state
*/ */
Authentication login(String username,Object password,ServletRequest request); Authentication login(String username,Object password,ServletRequest request);

View File

@ -28,12 +28,14 @@ import org.eclipse.jetty.io.Connection;
import org.eclipse.jetty.io.EndPoint; import org.eclipse.jetty.io.EndPoint;
/** /**
* <p>A Factory to create {@link Connection} instances for {@link Connector}s.</p> * A Factory to create {@link Connection} instances for {@link Connector}s.
* <p>A Connection factory is responsible for instantiating and configuring a {@link Connection} instance * <p>
* to handle an {@link EndPoint} accepted by a {@link Connector}.</p> * A Connection factory is responsible for instantiating and configuring a {@link Connection} instance
* to handle an {@link EndPoint} accepted by a {@link Connector}.
* <p> * <p>
* A ConnectionFactory has a protocol name that represents the protocol of the Connections * A ConnectionFactory has a protocol name that represents the protocol of the Connections
* created. Example of protocol names include:<dl> * created. Example of protocol names include:
* <dl>
* <dt>http</dt><dd>Creates a HTTP connection that can handle multiple versions of HTTP from 0.9 to 1.1</dd> * <dt>http</dt><dd>Creates a HTTP connection that can handle multiple versions of HTTP from 0.9 to 1.1</dd>
* <dt>h2</dt><dd>Creates a HTTP/2 connection that handles the HTTP/2 protocol</dd> * <dt>h2</dt><dd>Creates a HTTP/2 connection that handles the HTTP/2 protocol</dd>
* <dt>SSL-XYZ</dt><dd>Create an SSL connection chained to a connection obtained from a connection factory * <dt>SSL-XYZ</dt><dd>Create an SSL connection chained to a connection obtained from a connection factory
@ -77,7 +79,7 @@ public interface ConnectionFactory
* @param connector The connector to upgrade for. * @param connector The connector to upgrade for.
* @param endPoint The endpoint of the connection. * @param endPoint The endpoint of the connection.
* @param upgradeRequest The meta data of the upgrade request. * @param upgradeRequest The meta data of the upgrade request.
* @param reponseFields The fields to be sent with the 101 response * @param responseFields The fields to be sent with the 101 response
* @return Null to indicate that request processing should continue normally without upgrading. A new connection instance to * @return Null to indicate that request processing should continue normally without upgrading. A new connection instance to
* indicate that the upgrade should proceed. * indicate that the upgrade should proceed.
* @throws BadMessageException Thrown to indicate the upgrade attempt was illegal and that a bad message response should be sent. * @throws BadMessageException Thrown to indicate the upgrade attempt was illegal and that a bad message response should be sent.

View File

@ -60,6 +60,7 @@ public interface Connector extends LifeCycle, Graceful
public ByteBufferPool getByteBufferPool(); public ByteBufferPool getByteBufferPool();
/** /**
* @param nextProtocol the next protocol
* @return the {@link ConnectionFactory} associated with the protocol name * @return the {@link ConnectionFactory} associated with the protocol name
*/ */
public ConnectionFactory getConnectionFactory(String nextProtocol); public ConnectionFactory getConnectionFactory(String nextProtocol);

View File

@ -32,11 +32,13 @@ import org.eclipse.jetty.util.annotation.ManagedOperation;
import org.eclipse.jetty.util.component.Destroyable; import org.eclipse.jetty.util.component.Destroyable;
import org.eclipse.jetty.util.component.LifeCycle; import org.eclipse.jetty.util.component.LifeCycle;
/* ------------------------------------------------------------ */
/** A Jetty Server Handler. /** A Jetty Server Handler.
* * <p>
* A Handler instance is required by a {@link Server} to handle incoming * A Handler instance is required by a {@link Server} to handle incoming
* HTTP requests. A Handler may: <ul> * HTTP requests.
* <p>
* A Handler may:
* <ul>
* <li>Completely generate the HTTP Response</li> * <li>Completely generate the HTTP Response</li>
* <li>Examine/modify the request and call another Handler (see {@link HandlerWrapper}). * <li>Examine/modify the request and call another Handler (see {@link HandlerWrapper}).
* <li>Pass the request to one or more other Handlers (see {@link HandlerCollection}). * <li>Pass the request to one or more other Handlers (see {@link HandlerCollection}).
@ -51,18 +53,25 @@ import org.eclipse.jetty.util.component.LifeCycle;
@ManagedObject("Jetty Handler") @ManagedObject("Jetty Handler")
public interface Handler extends LifeCycle, Destroyable public interface Handler extends LifeCycle, Destroyable
{ {
/* ------------------------------------------------------------ */ /**
/** Handle a request. * Handle a request.
* @param target The target of the request - either a URI or a name. *
* @param baseRequest The original unwrapped request object. * @param target
* @param request The request either as the {@link Request} * The target of the request - either a URI or a name.
* object or a wrapper of that request. The {@link HttpChannel#getCurrentHttpChannel()} * @param baseRequest
* method can be used access the Request object if required. * The original unwrapped request object.
* @param response The response as the {@link Response} * @param request
* object or a wrapper of that request. The {@link HttpChannel#getCurrentHttpChannel()} * The request either as the {@link Request} object or a wrapper of that request. The
* method can be used access the Response object if required. * <code>{@link HttpConnection#getCurrentConnection()}.{@link HttpConnection#getHttpChannel() getHttpChannel()}.{@link HttpChannel#getRequest() getRequest()}</code>
* method can be used access the Request object if required.
* @param response
* The response as the {@link Response} object or a wrapper of that request. The
* <code>{@link HttpConnection#getCurrentConnection()}.{@link HttpConnection#getHttpChannel() getHttpChannel()}.{@link HttpChannel#getResponse() getResponse()}</code>
* method can be used access the Response object if required.
* @throws IOException * @throws IOException
* if unable to handle the request or response processing
* @throws ServletException * @throws ServletException
* if unable to handle the request or response due to underlying servlet issue
*/ */
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException; throws IOException, ServletException;
@ -74,6 +83,5 @@ public interface Handler extends LifeCycle, Destroyable
@ManagedOperation(value="destroy associated resources", impact="ACTION") @ManagedOperation(value="destroy associated resources", impact="ACTION")
public void destroy(); public void destroy();
} }

View File

@ -48,15 +48,16 @@ public interface HandlerContainer extends LifeCycle
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */
/** /**
* @param byclass * @param byclass the child handler class to get
* @return array of all handlers contained by this handler and it's children of the passed type. * @return array of all handlers contained by this handler and it's children of the passed type.
*/ */
public Handler[] getChildHandlersByClass(Class<?> byclass); public Handler[] getChildHandlersByClass(Class<?> byclass);
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */
/** /**
* @param byclass * @param byclass the child handler class to get
* @return first handler of all handlers contained by this handler and it's children of the passed type. * @return first handler of all handlers contained by this handler and it's children of the passed type.
* @param <T> the type of handler
*/ */
public <T extends Handler> T getChildHandlerByClass(Class<T> byclass); public <T extends Handler> T getChildHandlerByClass(Class<T> byclass);
} }

View File

@ -147,6 +147,7 @@ public class HttpChannel implements Runnable, HttpOutput.Interceptor
* Get the idle timeout. * Get the idle timeout.
* <p>This is implemented as a call to {@link EndPoint#getIdleTimeout()}, but may be * <p>This is implemented as a call to {@link EndPoint#getIdleTimeout()}, but may be
* overridden by channels that have timeouts different from their connections. * overridden by channels that have timeouts different from their connections.
* @return the idle timeout (in milliseconds)
*/ */
public long getIdleTimeout() public long getIdleTimeout()
{ {
@ -155,8 +156,9 @@ public class HttpChannel implements Runnable, HttpOutput.Interceptor
/** /**
* Set the idle timeout. * Set the idle timeout.
* <p>This is implemented as a call to {@link EndPoint#setIdleTimeout(long), but may be * <p>This is implemented as a call to {@link EndPoint#setIdleTimeout(long)}, but may be
* overridden by channels that have timeouts different from their connections. * overridden by channels that have timeouts different from their connections.
* @param timeoutMs the idle timeout in milliseconds
*/ */
public void setIdleTimeout(long timeoutMs) public void setIdleTimeout(long timeoutMs)
{ {
@ -213,7 +215,8 @@ public class HttpChannel implements Runnable, HttpOutput.Interceptor
* If the associated response has the Expect header set to 100 Continue, * If the associated response has the Expect header set to 100 Continue,
* then accessing the input stream indicates that the handler/servlet * then accessing the input stream indicates that the handler/servlet
* is ready for the request body and thus a 100 Continue response is sent. * is ready for the request body and thus a 100 Continue response is sent.
* *
* @param available estimate of the number of bytes that are available
* @throws IOException if the InputStream cannot be created * @throws IOException if the InputStream cannot be created
*/ */
public void continue100(int available) throws IOException public void continue100(int available) throws IOException

View File

@ -37,10 +37,6 @@ import org.eclipse.jetty.util.thread.SpinLock;
/** /**
* Implementation of AsyncContext interface that holds the state of request-response cycle. * Implementation of AsyncContext interface that holds the state of request-response cycle.
*/ */
/* ------------------------------------------------------------ */
/**
*/
public class HttpChannelState public class HttpChannelState
{ {
private static final Logger LOG = Log.getLogger(HttpChannelState.class); private static final Logger LOG = Log.getLogger(HttpChannelState.class);
@ -804,7 +800,7 @@ public class HttpChannelState
* This is similar to calling {@link #onReadUnready()} followed by * This is similar to calling {@link #onReadUnready()} followed by
* {@link #onReadPossible()}, except that as content is already * {@link #onReadPossible()}, except that as content is already
* available, read interest is never set. * available, read interest is never set.
* @return * @return true if woken
*/ */
public boolean onReadReady() public boolean onReadReady()
{ {

View File

@ -32,6 +32,7 @@ import org.eclipse.jetty.http.HttpParser;
import org.eclipse.jetty.http.HttpStatus; import org.eclipse.jetty.http.HttpStatus;
import org.eclipse.jetty.http.MetaData; import org.eclipse.jetty.http.MetaData;
import org.eclipse.jetty.http.PreEncodedHttpField; import org.eclipse.jetty.http.PreEncodedHttpField;
import org.eclipse.jetty.http.HttpParser.RequestHandler;
import org.eclipse.jetty.io.AbstractConnection; import org.eclipse.jetty.io.AbstractConnection;
import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.ByteBufferPool;
import org.eclipse.jetty.io.Connection; import org.eclipse.jetty.io.Connection;
@ -260,7 +261,7 @@ public class HttpConnection extends AbstractConnection implements Runnable, Http
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */
/** Fill and parse data looking for content /** Fill and parse data looking for content
* @throws IOException * @return true if an {@link RequestHandler} method was called and it returned true;
*/ */
protected boolean fillAndParseForContent() protected boolean fillAndParseForContent()
{ {

View File

@ -41,7 +41,6 @@ import org.eclipse.jetty.util.log.Logger;
* maintains two states: the content state that tells whether there is content to consume and the EOF * maintains two states: the content state that tells whether there is content to consume and the EOF
* state that tells whether an EOF has arrived. * state that tells whether an EOF has arrived.
* Only once the content has been consumed the content state is moved to the EOF state. * Only once the content has been consumed the content state is moved to the EOF state.
*
*/ */
public class HttpInput extends ServletInputStream implements Runnable public class HttpInput extends ServletInputStream implements Runnable
{ {
@ -157,7 +156,7 @@ public class HttpInput extends ServletInputStream implements Runnable
* produce more Content and add it via {@link #addContent(Content)}. * produce more Content and add it via {@link #addContent(Content)}.
* For protocols that are constantly producing (eg HTTP2) this can * For protocols that are constantly producing (eg HTTP2) this can
* be left as a noop; * be left as a noop;
* @throws IOException * @throws IOException if unable to produce content
*/ */
protected void produceContent() throws IOException protected void produceContent() throws IOException
{ {
@ -351,7 +350,8 @@ public class HttpInput extends ServletInputStream implements Runnable
/** /**
* Adds some content to this input stream. * Adds some content to this input stream.
* *
* @param content the content to add * @param item the content to add
* @return true if content channel woken for read
*/ */
public boolean addContent(Content item) public boolean addContent(Content item)
{ {
@ -401,6 +401,7 @@ public class HttpInput extends ServletInputStream implements Runnable
* <p> * <p>
* Typically this will result in an EOFException being thrown * Typically this will result in an EOFException being thrown
* from a subsequent read rather than a -1 return. * from a subsequent read rather than a -1 return.
* @return true if content channel woken for read
*/ */
public boolean earlyEOF() public boolean earlyEOF()
{ {
@ -410,6 +411,7 @@ public class HttpInput extends ServletInputStream implements Runnable
/** /**
* This method should be called to signal that all the expected * This method should be called to signal that all the expected
* content arrived. * content arrived.
* @return true if content channel woken for read
*/ */
public boolean eof() public boolean eof()
{ {

View File

@ -37,11 +37,14 @@ import org.eclipse.jetty.util.thread.Scheduler;
import org.eclipse.jetty.util.thread.ThreadPool; import org.eclipse.jetty.util.thread.ThreadPool;
/* ------------------------------------------------------------ */ /**
/** A monitor for low resources * A monitor for low resources
* <p>An instance of this class will monitor all the connectors of a server (or a set of connectors * <p>
* An instance of this class will monitor all the connectors of a server (or a set of connectors
* configured with {@link #setMonitoredConnectors(Collection)}) for a low resources state. * configured with {@link #setMonitoredConnectors(Collection)}) for a low resources state.
* Low resources can be detected by:<ul> * <p>
* Low resources can be detected by:
* <ul>
* <li>{@link ThreadPool#isLowOnThreads()} if {@link Connector#getExecutor()} is * <li>{@link ThreadPool#isLowOnThreads()} if {@link Connector#getExecutor()} is
* an instance of {@link ThreadPool} and {@link #setMonitorThreads(boolean)} is true.<li> * an instance of {@link ThreadPool} and {@link #setMonitorThreads(boolean)} is true.<li>
* <li>If {@link #setMaxMemory(long)} is non zero then low resources is detected if the JVMs * <li>If {@link #setMaxMemory(long)} is non zero then low resources is detected if the JVMs
@ -50,14 +53,13 @@ import org.eclipse.jetty.util.thread.ThreadPool;
* <li>If {@link #setMaxConnections(int)} is non zero then low resources is dected if the total number * <li>If {@link #setMaxConnections(int)} is non zero then low resources is dected if the total number
* of connections exceeds {@link #getMaxConnections()}</li> * of connections exceeds {@link #getMaxConnections()}</li>
* </ul> * </ul>
* </p> * <p>
* <p>Once low resources state is detected, the cause is logged and all existing connections returned * Once low resources state is detected, the cause is logged and all existing connections returned
* by {@link Connector#getConnectedEndPoints()} have {@link EndPoint#setIdleTimeout(long)} set * by {@link Connector#getConnectedEndPoints()} have {@link EndPoint#setIdleTimeout(long)} set
* to {@link #getLowResourcesIdleTimeout()}. New connections are not affected, however if the low * to {@link #getLowResourcesIdleTimeout()}. New connections are not affected, however if the low
* resources state persists for more than {@link #getMaxLowResourcesTime()}, then the * resources state persists for more than {@link #getMaxLowResourcesTime()}, then the
* {@link #getLowResourcesIdleTimeout()} to all connections again. Once the low resources state is * {@link #getLowResourcesIdleTimeout()} to all connections again. Once the low resources state is
* cleared, the idle timeout is reset to the connector default given by {@link Connector#getIdleTimeout()}. * cleared, the idle timeout is reset to the connector default given by {@link Connector#getIdleTimeout()}.
* </p>
*/ */
@ManagedObject ("Monitor for low resource conditions and activate a low resource mode if detected") @ManagedObject ("Monitor for low resource conditions and activate a low resource mode if detected")
public class LowResourceMonitor extends AbstractLifeCycle public class LowResourceMonitor extends AbstractLifeCycle

View File

@ -35,11 +35,12 @@ import org.eclipse.jetty.util.log.Logger;
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */
/** ConnectionFactory for the PROXY Protocol. /**
* ConnectionFactory for the PROXY Protocol.
* <p>This factory can be placed in front of any other connection factory * <p>This factory can be placed in front of any other connection factory
* to process the proxy line before the normal protocol handling</p> * to process the proxy line before the normal protocol handling</p>
* *
* @see http://www.haproxy.org/download/1.5/doc/proxy-protocol.txt * @see <a href="http://www.haproxy.org/download/1.5/doc/proxy-protocol.txt">http://www.haproxy.org/download/1.5/doc/proxy-protocol.txt</a>
*/ */
public class ProxyConnectionFactory extends AbstractConnectionFactory public class ProxyConnectionFactory extends AbstractConnectionFactory
{ {

View File

@ -20,47 +20,47 @@ package org.eclipse.jetty.server;
import java.util.Set; import java.util.Set;
import javax.servlet.ServletRequest;
import javax.servlet.http.Cookie; import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession; import javax.servlet.http.HttpSession;
/** Build a request to be pushed. /** Build a request to be pushed.
* <p>
* A PushBuilder is obtained by calling {@link Request#getPushBuilder()} * A PushBuilder is obtained by calling {@link Request#getPushBuilder()}
* which creates an initialises the builder as follows:<ul> * which creates an initializes the builder as follows:
* <ul>
* <li> Each call to getPushBuilder() will return a new instance of a * <li> Each call to getPushBuilder() will return a new instance of a
* PushBuilder based off the Request. Any mutations to the * PushBuilder based off the Request. Any mutations to the
* returned PushBuilder are not reflected on future returns.</li> * returned PushBuilder are not reflected on future returns.</li>
* <li>The method is initialised to "GET"</li> * <li>The method is initialized to "GET"</li>
* <li>The requests headers are added to the Builder, except for:<ul> * <li>The requests headers are added to the Builder, except for:<ul>
* <li>Conditional headers (eg. If-Modified-Since) * <li>Conditional headers (eg. If-Modified-Since)
* <li>Range headers * <li>Range headers
* <li>Expect headers * <li>Expect headers
* <li>Authorisation headers * <li>Authorization headers
* <li>Referrer headers * <li>Referrer headers
* </ul></li> * </ul></li>
* <li>If the request was Authenticated, an Authorisation header will * <li>If the request was Authenticated, an Authorization header will
* be set with a container generated token that will result in equivalent * be set with a container generated token that will result in equivalent
* Authorisation for the pushed request</li> * Authorization for the pushed request</li>
* <li>The query string from {@link ServletRequest#getQueryString()} * <li>The query string from {@link HttpServletRequest#getQueryString()}
* <li>The {@link ServletRequest#getRequestedSessionId()} value, unless at the time * <li>The {@link HttpServletRequest#getRequestedSessionId()} value, unless at the time
* of the call {@link ServletRequest#getSession(boolean)} * of the call {@link HttpServletRequest#getSession(boolean)}
* has previously been called to create a new {@link HttpSession}, in * has previously been called to create a new {@link HttpSession}, in
* which case the new session ID will be used as the PushBuilders * which case the new session ID will be used as the PushBuilders
* requested session ID. The source of the requested session id will be the * requested session ID. The source of the requested session id will be the
* same as for the request</li> * same as for the request</li>
* <li>The Referer header will be set to {@link ServletRequest#getRequestURL()} * <li>The Referer header will be set to {@link HttpServletRequest#getRequestURL()}
* plus any {@link ServletRequest#getQueryString()} </li> * plus any {@link HttpServletRequest#getQueryString()} </li>
* <li>If {@link HttpServletResponse#addCookie(Cookie)} has been called * <li>If {@link HttpServletResponse#addCookie(Cookie)} has been called
* on the associated response, then a corresponding Cookie header will be added * on the associated response, then a corresponding Cookie header will be added
* to the PushBuilder, unless the {@link Cookie#getMaxAge()} is <=0, in which * to the PushBuilder, unless the {@link Cookie#getMaxAge()} is &lt;=0, in which
* case the Cookie will be removed from the builder.</li> * case the Cookie will be removed from the builder.</li>
* <li>If this request has has the conditional headers If-Modified-Since or * <li>If this request has has the conditional headers If-Modified-Since or
* If-None-Match then the {@link #isConditional()} header is set to true.</li> * If-None-Match then the {@link #isConditional()} header is set to true.</li>
* </ul> * </ul>
* <p>A PushBuilder can be customised by chained calls to mutator methods before the * <p>A PushBuilder can be customized by chained calls to mutator methods before the
* {@link #push()} method is called to initiate a push request with the current state * {@link #push()} method is called to initiate a push request with the current state
* of the builder. After the call to {@link #push()}, the builder may be reused for * of the builder. After the call to {@link #push()}, the builder may be reused for
* another push, however the {@link #path(String)}, {@link #etag(String)} and * another push, however the {@link #path(String)}, {@link #etag(String)} and
@ -128,7 +128,7 @@ public interface PushBuilder
* the associated request. * the associated request.
* There is no path default and {@link #path(String)} must be called * There is no path default and {@link #path(String)} must be called
* before every call to {@link #push()} * before every call to {@link #push()}
* @param the URI path to be used for the push, which may include a * @param path the URI path to be used for the push, which may include a
* query string. * query string.
* @return this builder. * @return this builder.
*/ */
@ -138,7 +138,7 @@ public interface PushBuilder
* The etag will be used only if {@link #isConditional()} is true. * The etag will be used only if {@link #isConditional()} is true.
* Defaults to no etag. The value is nulled after every call to * Defaults to no etag. The value is nulled after every call to
* {@link #push()} * {@link #push()}
* @param the etag to be used for the push. * @param etag the etag to be used for the push.
* @return this builder. * @return this builder.
*/ */
public abstract PushBuilder etag(String etag); public abstract PushBuilder etag(String etag);
@ -147,7 +147,7 @@ public interface PushBuilder
* The last modified date will be used only if {@link #isConditional()} is true. * The last modified date will be used only if {@link #isConditional()} is true.
* Defaults to no date. The value is nulled after every call to * Defaults to no date. The value is nulled after every call to
* {@link #push()} * {@link #push()}
* @param the last modified date to be used for the push. * @param lastModified the last modified date to be used for the push.
* @return this builder. * @return this builder.
* */ * */
public abstract PushBuilder lastModified(String lastModified); public abstract PushBuilder lastModified(String lastModified);

View File

@ -88,7 +88,6 @@ import org.eclipse.jetty.util.UrlEncoded;
import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger; import org.eclipse.jetty.util.log.Logger;
/* ------------------------------------------------------------ */
/** /**
* Jetty Request. * Jetty Request.
* <p> * <p>
@ -117,8 +116,6 @@ import org.eclipse.jetty.util.log.Logger;
* {@link ContextHandler#getMaxFormContentSize()} or if there is no context then the "org.eclipse.jetty.server.Request.maxFormContentSize" {@link Server} * {@link ContextHandler#getMaxFormContentSize()} or if there is no context then the "org.eclipse.jetty.server.Request.maxFormContentSize" {@link Server}
* attribute. The number of parameters keys is limited by {@link ContextHandler#getMaxFormKeys()} or if there is no context then the * attribute. The number of parameters keys is limited by {@link ContextHandler#getMaxFormKeys()} or if there is no context then the
* "org.eclipse.jetty.server.Request.maxFormKeys" {@link Server} attribute. * "org.eclipse.jetty.server.Request.maxFormKeys" {@link Server} attribute.
*
*
*/ */
public class Request implements HttpServletRequest public class Request implements HttpServletRequest
{ {
@ -255,7 +252,7 @@ public class Request implements HttpServletRequest
* plus any {@link #getQueryString()} </li> * plus any {@link #getQueryString()} </li>
* <li>If {@link HttpServletResponse#addCookie(Cookie)} has been called * <li>If {@link HttpServletResponse#addCookie(Cookie)} has been called
* on the associated response, then a corresponding Cookie header will be added * on the associated response, then a corresponding Cookie header will be added
* to the PushBuilder, unless the {@link Cookie#getMaxAge()} is <=0, in which * to the PushBuilder, unless the {@link Cookie#getMaxAge()} is &lt;=0, in which
* case the Cookie will be removed from the builder.</li> * case the Cookie will be removed from the builder.</li>
* <li>If this request has has the conditional headers If-Modified-Since or * <li>If this request has has the conditional headers If-Modified-Since or
* If-None-Match then the {@link PushBuilderImpl#isConditional()} header is set * If-None-Match then the {@link PushBuilderImpl#isConditional()} header is set
@ -524,7 +521,8 @@ public class Request implements HttpServletRequest
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */
/** /**
* Get Request Attribute. * Get Request Attribute.
* <p>Also supports jetty specific attributes to gain access to Jetty APIs: * <p>
* Also supports jetty specific attributes to gain access to Jetty APIs:
* <dl> * <dl>
* <dt>org.eclipse.jetty.server.Server</dt><dd>The Jetty Server instance</dd> * <dt>org.eclipse.jetty.server.Server</dt><dd>The Jetty Server instance</dd>
* <dt>org.eclipse.jetty.server.HttpChannel</dt><dd>The HttpChannel for this request</dd> * <dt>org.eclipse.jetty.server.HttpChannel</dt><dd>The HttpChannel for this request</dd>
@ -532,7 +530,6 @@ public class Request implements HttpServletRequest
* </dl> * </dl>
* While these attributes may look like security problems, they are exposing nothing that is not already * While these attributes may look like security problems, they are exposing nothing that is not already
* available via reflection from a Request instance. * available via reflection from a Request instance.
* </p>
* @see javax.servlet.ServletRequest#getAttribute(java.lang.String) * @see javax.servlet.ServletRequest#getAttribute(java.lang.String)
*/ */
@Override @Override
@ -1583,7 +1580,7 @@ public class Request implements HttpServletRequest
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */
/** /**
* @param old_uri * @param uri the URI to set
*/ */
public void setHttpURI(HttpURI uri) public void setHttpURI(HttpURI uri)
{ {
@ -1745,7 +1742,7 @@ public class Request implements HttpServletRequest
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */
/** /**
* @param request * @param request the Request metadata
*/ */
public void setMetaData(org.eclipse.jetty.http.MetaData.Request request) public void setMetaData(org.eclipse.jetty.http.MetaData.Request request)
{ {
@ -2030,7 +2027,7 @@ public class Request implements HttpServletRequest
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */
/** /**
* Sets the "context path" for this request * Sets the "context path" for this request
* * @param contextPath the context path for this request
* @see HttpServletRequest#getContextPath() * @see HttpServletRequest#getContextPath()
*/ */
public void setContextPath(String contextPath) public void setContextPath(String contextPath)
@ -2095,7 +2092,7 @@ public class Request implements HttpServletRequest
* *
* The request attribute "org.eclipse.jetty.server.server.Request.queryEncoding" may be set as an alternate method of calling setQueryEncoding. * The request attribute "org.eclipse.jetty.server.server.Request.queryEncoding" may be set as an alternate method of calling setQueryEncoding.
* *
* @param queryEncoding * @param queryEncoding the URI query character encoding
*/ */
public void setQueryEncoding(String queryEncoding) public void setQueryEncoding(String queryEncoding)
{ {
@ -2163,6 +2160,8 @@ public class Request implements HttpServletRequest
/** /**
* @param host * @param host
* The host to set. * The host to set.
* @param port
* the port to set
*/ */
public void setAuthority(String host,int port) public void setAuthority(String host,int port)
{ {

View File

@ -46,10 +46,6 @@ import org.eclipse.jetty.util.resource.Resource;
import org.eclipse.jetty.util.resource.ResourceFactory; import org.eclipse.jetty.util.resource.ResourceFactory;
/* ------------------------------------------------------------ */
/**
*
*/
public class ResourceCache public class ResourceCache
{ {
private static final Logger LOG = Log.getLogger(ResourceCache.class); private static final Logger LOG = Log.getLogger(ResourceCache.class);
@ -69,7 +65,11 @@ public class ResourceCache
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */
/** Constructor. /** Constructor.
* @param parent the parent resource cache
* @param factory the resource factory
* @param mimeTypes Mimetype to use for meta data * @param mimeTypes Mimetype to use for meta data
* @param useFileMappedBuffer true to file memory mapped buffers
* @param etags true to support etags
*/ */
public ResourceCache(ResourceCache parent, ResourceFactory factory, MimeTypes mimeTypes,boolean useFileMappedBuffer,boolean etags) public ResourceCache(ResourceCache parent, ResourceFactory factory, MimeTypes mimeTypes,boolean useFileMappedBuffer,boolean etags)
{ {
@ -201,7 +201,7 @@ public class ResourceCache
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */
/** /**
* @param resource * @param resource the resource to test
* @return True if the resource is cacheable. The default implementation tests the cache sizes. * @return True if the resource is cacheable. The default implementation tests the cache sizes.
*/ */
protected boolean isCacheable(Resource resource) protected boolean isCacheable(Resource resource)

View File

@ -217,7 +217,7 @@ public class Response implements HttpServletResponse
* @param domain the domain * @param domain the domain
* @param path the path * @param path the path
* @param maxAge the maximum age * @param maxAge the maximum age
* @param comment the comment (only present on versions > 0) * @param comment the comment (only present on versions &gt; 0)
* @param isSecure true if secure cookie * @param isSecure true if secure cookie
* @param isHttpOnly true if for http only * @param isHttpOnly true if for http only
* @param version version of cookie logic to use (0 == default behavior) * @param version version of cookie logic to use (0 == default behavior)
@ -634,6 +634,7 @@ public class Response implements HttpServletResponse
* request has a Expect header starting with 102, then a 102 response is * request has a Expect header starting with 102, then a 102 response is
* sent. This indicates that the request still be processed and real response * sent. This indicates that the request still be processed and real response
* can still be sent. This method is called by sendError if it is passed 102. * can still be sent. This method is called by sendError if it is passed 102.
* @throws IOException if unable to send the 102 response
* @see javax.servlet.http.HttpServletResponse#sendError(int) * @see javax.servlet.http.HttpServletResponse#sendError(int)
*/ */
public void sendProcessing() throws IOException public void sendProcessing() throws IOException
@ -646,9 +647,9 @@ public class Response implements HttpServletResponse
/** /**
* Sends a response with one of the 300 series redirection codes. * Sends a response with one of the 300 series redirection codes.
* @param code * @param code the redirect status code
* @param location * @param location the location to send in <code>Location</code> headers
* @throws IOException * @throws IOException if unable to send the redirect
*/ */
public void sendRedirect(int code, String location) throws IOException public void sendRedirect(int code, String location) throws IOException
{ {

View File

@ -110,8 +110,11 @@ public class Server extends HandlerWrapper implements Attributes
} }
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */
/** Convenience constructor /**
* Convenience constructor
* <p>
* Creates server and a {@link ServerConnector} at the passed address. * Creates server and a {@link ServerConnector} at the passed address.
* @param addr the inet socket address to create the connector from
*/ */
public Server(@Name("address")InetSocketAddress addr) public Server(@Name("address")InetSocketAddress addr)
{ {

View File

@ -53,7 +53,6 @@ import org.eclipse.jetty.util.thread.Scheduler;
* use all the commons services (eg {@link Executor}, {@link Scheduler}) of the * use all the commons services (eg {@link Executor}, {@link Scheduler}) of the
* passed {@link Server} instance, but all services may also be constructor injected * passed {@link Server} instance, but all services may also be constructor injected
* into the connector so that it may operate with dedicated or otherwise shared services. * into the connector so that it may operate with dedicated or otherwise shared services.
* <p>
* <h2>Connection Factories</h2> * <h2>Connection Factories</h2>
* Various convenience constructors are provided to assist with common configurations of * Various convenience constructors are provided to assist with common configurations of
* ConnectionFactories, whose generic use is described in {@link AbstractConnector}. * ConnectionFactories, whose generic use is described in {@link AbstractConnector}.
@ -61,7 +60,6 @@ import org.eclipse.jetty.util.thread.Scheduler;
* default to use a {@link HttpConnectionFactory}. If an non null {@link SslContextFactory} * default to use a {@link HttpConnectionFactory}. If an non null {@link SslContextFactory}
* instance is passed, then this used to instantiate a {@link SslConnectionFactory} which is * instance is passed, then this used to instantiate a {@link SslConnectionFactory} which is
* prepended to the other passed or default factories. * prepended to the other passed or default factories.
* <p>
* <h2>Selectors</h2> * <h2>Selectors</h2>
* The connector will use the {@link Executor} service to execute a number of Selector Tasks, * The connector will use the {@link Executor} service to execute a number of Selector Tasks,
* which are implemented to each use a NIO {@link Selector} instance to asynchronously * which are implemented to each use a NIO {@link Selector} instance to asynchronously
@ -107,7 +105,7 @@ public class ServerConnector extends AbstractNetworkConnector
* the number of acceptor threads to use, or -1 for a default value. Acceptors accept new TCP/IP connections. If 0, then * the number of acceptor threads to use, or -1 for a default value. Acceptors accept new TCP/IP connections. If 0, then
* the selector threads are used to accept connections. * the selector threads are used to accept connections.
* @param selectors * @param selectors
* the number of selector threads, or <=0 for a default value. Selectors notice and schedule established connection that can make IO progress. * the number of selector threads, or &lt;=0 for a default value. Selectors notice and schedule established connection that can make IO progress.
*/ */
public ServerConnector( public ServerConnector(
@Name("server") Server server, @Name("server") Server server,
@ -125,7 +123,7 @@ public class ServerConnector extends AbstractNetworkConnector
* the number of acceptor threads to use, or -1 for a default value. Acceptors accept new TCP/IP connections. If 0, then * the number of acceptor threads to use, or -1 for a default value. Acceptors accept new TCP/IP connections. If 0, then
* the selector threads are used to accept connections. * the selector threads are used to accept connections.
* @param selectors * @param selectors
* the number of selector threads, or <=0 for a default value. Selectors notice and schedule established connection that can make IO progress. * the number of selector threads, or &lt;=0 for a default value. Selectors notice and schedule established connection that can make IO progress.
* @param factories Zero or more {@link ConnectionFactory} instances used to create and configure connections. * @param factories Zero or more {@link ConnectionFactory} instances used to create and configure connections.
*/ */
public ServerConnector( public ServerConnector(
@ -174,7 +172,7 @@ public class ServerConnector extends AbstractNetworkConnector
* the number of acceptor threads to use, or -1 for a default value. Acceptors accept new TCP/IP connections. If 0, then * the number of acceptor threads to use, or -1 for a default value. Acceptors accept new TCP/IP connections. If 0, then
* the selector threads are used to accept connections. * the selector threads are used to accept connections.
* @param selectors * @param selectors
* the number of selector threads, or <=0 for a default value. Selectors notice and schedule established connection that can make IO progress. * the number of selector threads, or &lt;=0 for a default value. Selectors notice and schedule established connection that can make IO progress.
*/ */
public ServerConnector( public ServerConnector(
@Name("server") Server server, @Name("server") Server server,
@ -214,7 +212,7 @@ public class ServerConnector extends AbstractNetworkConnector
* the number of acceptor threads to use, or -1 for a default value. Acceptors accept new TCP/IP connections. If 0, then * the number of acceptor threads to use, or -1 for a default value. Acceptors accept new TCP/IP connections. If 0, then
* the selector threads are used to accept connections. * the selector threads are used to accept connections.
* @param selectors * @param selectors
* the number of selector threads, or <=0 for a default value. Selectors notice and schedule established connection that can make IO progress. * the number of selector threads, or &lt;=0 for a default value. Selectors notice and schedule established connection that can make IO progress.
* @param factories * @param factories
* Zero or more {@link ConnectionFactory} instances used to create and configure connections. * Zero or more {@link ConnectionFactory} instances used to create and configure connections.
*/ */
@ -260,6 +258,7 @@ public class ServerConnector extends AbstractNetworkConnector
} }
/** /**
* @return the selector priority delta
* @deprecated not implemented * @deprecated not implemented
*/ */
@Deprecated @Deprecated
@ -269,6 +268,7 @@ public class ServerConnector extends AbstractNetworkConnector
} }
/** /**
* @param selectorPriorityDelta the selector priority delta
* @deprecated not implemented * @deprecated not implemented
*/ */
@Deprecated @Deprecated
@ -342,7 +342,7 @@ public class ServerConnector extends AbstractNetworkConnector
@Override @Override
public Future<Void> shutdown() public Future<Void> shutdown()
{ {
// TODO shutdown all the connections // shutdown all the connections
return super.shutdown(); return super.shutdown();
} }

View File

@ -42,7 +42,7 @@ public interface SessionIdManager extends LifeCycle
/** /**
* Remove session from the list of known sessions for a given ID. * Remove session from the list of known sessions for a given ID.
* @param session * @param session the session to remove
*/ */
public void removeSession(HttpSession session); public void removeSession(HttpSession session);
@ -53,8 +53,10 @@ public interface SessionIdManager extends LifeCycle
public void invalidateAll(String id); public void invalidateAll(String id);
/** /**
* @param request * Create a new Session ID.
* @param created *
* @param request the request with the sesion
* @param created the timestamp for when the session was created
* @return the new session id * @return the new session id
*/ */
public String newSessionId(HttpServletRequest request,long created); public String newSessionId(HttpServletRequest request,long created);
@ -67,7 +69,7 @@ public interface SessionIdManager extends LifeCycle
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */
/** Get a cluster ID from a node ID. /** Get a cluster ID from a node ID.
* Strip node identifier from a located session ID. * Strip node identifier from a located session ID.
* @param nodeId * @param nodeId the node id
* @return the cluster id * @return the cluster id
*/ */
public String getClusterId(String nodeId); public String getClusterId(String nodeId);
@ -84,9 +86,9 @@ public interface SessionIdManager extends LifeCycle
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */
/** Change the existing session id. /** Change the existing session id.
* *
* @param oldClusterId * @param oldClusterId the old cluster id
* @param oldNodeId * @param oldNodeId the old node id
* @param request * @param request the request containing the session
*/ */
public void renewSessionId(String oldClusterId, String oldNodeId, HttpServletRequest request); public void renewSessionId(String oldClusterId, String oldNodeId, HttpServletRequest request);

View File

@ -308,10 +308,10 @@ public interface SessionManager extends LifeCycle
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */
/** Change the existing session id. /** Change the existing session id.
* *
* @param oldClusterId * @param oldClusterId the old cluster id
* @param oldNodeId * @param oldNodeId the old node id
* @param newClusterId * @param newClusterId the new cluster id
* @param newNodeId * @param newNodeId the new node id
*/ */
public void renewSessionId(String oldClusterId, String oldNodeId, String newClusterId, String newNodeId); public void renewSessionId(String oldClusterId, String oldNodeId, String newClusterId, String newNodeId);
} }

View File

@ -259,7 +259,7 @@ public class ShutdownMonitor
* Stop the registered lifecycles, optionally * Stop the registered lifecycles, optionally
* calling destroy on them. * calling destroy on them.
* *
* @param destroy * @param destroy true if {@link Destroyable}'s should also be destroyed.
*/ */
public void stopLifeCycles (boolean destroy) public void stopLifeCycles (boolean destroy)
{ {
@ -450,7 +450,7 @@ public class ShutdownMonitor
} }
/** /**
* @param exitVm * @param exitVm true to exit the VM on shutdown
*/ */
public void setExitVm(boolean exitVm) public void setExitVm(boolean exitVm)
{ {

View File

@ -23,13 +23,12 @@ import java.util.Map;
import javax.security.auth.Subject; import javax.security.auth.Subject;
/* ------------------------------------------------------------ */ /**
/** User object that encapsulates user identity and operations such as run-as-role actions, * User object that encapsulates user identity and operations such as run-as-role actions,
* checking isUserInRole and getUserPrincipal. * checking isUserInRole and getUserPrincipal.
* * <p>
* Implementations of UserIdentity should be immutable so that they may be * Implementations of UserIdentity should be immutable so that they may be
* cached by Authenticators and LoginServices. * cached by Authenticators and LoginServices.
*
*/ */
public interface UserIdentity public interface UserIdentity
{ {
@ -50,7 +49,7 @@ public interface UserIdentity
* This call is used to satisfy authorization calls from * This call is used to satisfy authorization calls from
* container code which will be using translated role names. * container code which will be using translated role names.
* @param role A role name. * @param role A role name.
* @param scope * @param scope the scope
* @return True if the user can act in that role. * @return True if the user can act in that role.
*/ */
boolean isUserInRole(String role, Scope scope); boolean isUserInRole(String role, Scope scope);

View File

@ -191,18 +191,12 @@ public class ContextHandler extends ScopedHandler implements Attributes, Gracefu
private volatile Availability _availability; private volatile Availability _availability;
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */
/**
*
*/
public ContextHandler() public ContextHandler()
{ {
this((Context)null); this((Context)null);
} }
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */
/**
*
*/
protected ContextHandler(Context context) protected ContextHandler(Context context)
{ {
super(); super();
@ -215,9 +209,6 @@ public class ContextHandler extends ScopedHandler implements Attributes, Gracefu
} }
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */
/**
*
*/
public ContextHandler(String contextPath) public ContextHandler(String contextPath)
{ {
this(); this();
@ -225,9 +216,6 @@ public class ContextHandler extends ScopedHandler implements Attributes, Gracefu
} }
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */
/**
*
*/
public ContextHandler(HandlerContainer parent, String contextPath) public ContextHandler(HandlerContainer parent, String contextPath)
{ {
this(); this();
@ -568,6 +556,7 @@ public class ContextHandler extends ScopedHandler implements Attributes, Gracefu
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */
/** /**
* Add a context event listeners. * Add a context event listeners.
* @param listener the event listener to add
* *
* @see ServletContextListener * @see ServletContextListener
* @see ServletContextAttributeListener * @see ServletContextAttributeListener
@ -597,6 +586,7 @@ public class ContextHandler extends ScopedHandler implements Attributes, Gracefu
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */
/** /**
* Remove a context event listeners. * Remove a context event listeners.
* @param listener the event listener to remove
* *
* @see ServletContextListener * @see ServletContextListener
* @see ServletContextAttributeListener * @see ServletContextAttributeListener
@ -624,7 +614,7 @@ public class ContextHandler extends ScopedHandler implements Attributes, Gracefu
/** /**
* Apply any necessary restrictions on a programmatic added listener. * Apply any necessary restrictions on a programmatic added listener.
* *
* @param listener * @param listener the programmatic listener to add
*/ */
protected void addProgrammaticListener (EventListener listener) protected void addProgrammaticListener (EventListener listener)
{ {
@ -680,6 +670,7 @@ public class ContextHandler extends ScopedHandler implements Attributes, Gracefu
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */
/** /**
* Set Available status. * Set Available status.
* @param available true to set as enabled
*/ */
public void setAvailable(boolean available) public void setAvailable(boolean available)
{ {
@ -759,6 +750,7 @@ public class ContextHandler extends ScopedHandler implements Attributes, Gracefu
/** /**
* Extensible startContext. this method is called from {@link ContextHandler#doStart()} instead of a call to super.doStart(). This allows derived classes to * Extensible startContext. this method is called from {@link ContextHandler#doStart()} instead of a call to super.doStart(). This allows derived classes to
* insert additional handling (Eg configuration) before the call to super.doStart by this method will start contained handlers. * insert additional handling (Eg configuration) before the call to super.doStart by this method will start contained handlers.
* @throws Exception if unable to start the context
* *
* @see org.eclipse.jetty.server.handler.ContextHandler.Context * @see org.eclipse.jetty.server.handler.ContextHandler.Context
*/ */
@ -1190,8 +1182,9 @@ public class ContextHandler extends ScopedHandler implements Attributes, Gracefu
/** /**
* Check the target. Called by {@link #handle(String, Request, HttpServletRequest, HttpServletResponse)} when a target within a context is determined. If * Check the target. Called by {@link #handle(String, Request, HttpServletRequest, HttpServletResponse)} when a target within a context is determined. If
* the target is protected, 404 is returned. * the target is protected, 404 is returned.
* @param target the target to test
* @return true if target is a protected target
*/ */
/* ------------------------------------------------------------ */
public boolean isProtectedTarget(String target) public boolean isProtectedTarget(String target)
{ {
if (target == null || _protectedTargets == null) if (target == null || _protectedTargets == null)
@ -1450,8 +1443,6 @@ public class ContextHandler extends ScopedHandler implements Attributes, Gracefu
} }
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */
/**
*/
public void setWelcomeFiles(String[] files) public void setWelcomeFiles(String[] files)
{ {
_welcomeFiles = files; _welcomeFiles = files;
@ -1502,7 +1493,7 @@ public class ContextHandler extends ScopedHandler implements Attributes, Gracefu
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */
/** /**
* Set the maximum size of a form post, to protect against DOS attacks from large forms. * Set the maximum size of a form post, to protect against DOS attacks from large forms.
* @param maxSize * @param maxSize the maximum size of the form content (in bytes)
*/ */
public void setMaxFormContentSize(int maxSize) public void setMaxFormContentSize(int maxSize)
{ {
@ -1518,7 +1509,7 @@ public class ContextHandler extends ScopedHandler implements Attributes, Gracefu
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */
/** /**
* Set the maximum number of form Keys to protect against DOS attack from crafted hash keys. * Set the maximum number of form Keys to protect against DOS attack from crafted hash keys.
* @param max * @param max the maximum number of form keys
*/ */
public void setMaxFormKeys(int max) public void setMaxFormKeys(int max)
{ {
@ -1664,8 +1655,8 @@ public class ContextHandler extends ScopedHandler implements Attributes, Gracefu
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */
/** /**
* @param path * @param path the path to check the alias for
* @param resource * @param resource the resource
* @return True if the alias is OK * @return True if the alias is OK
*/ */
public boolean checkAlias(String path, Resource resource) public boolean checkAlias(String path, Resource resource)
@ -1695,6 +1686,9 @@ public class ContextHandler extends ScopedHandler implements Attributes, Gracefu
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */
/** /**
* Convert URL to Resource wrapper for {@link Resource#newResource(URL)} enables extensions to provide alternate resource implementations. * Convert URL to Resource wrapper for {@link Resource#newResource(URL)} enables extensions to provide alternate resource implementations.
* @param url the url to convert to a Resource
* @return the Resource for that url
* @throws IOException if unable to create a Resource from the URL
*/ */
public Resource newResource(URL url) throws IOException public Resource newResource(URL url) throws IOException
{ {
@ -1704,6 +1698,9 @@ public class ContextHandler extends ScopedHandler implements Attributes, Gracefu
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */
/** /**
* Convert URL to Resource wrapper for {@link Resource#newResource(URL)} enables extensions to provide alternate resource implementations. * Convert URL to Resource wrapper for {@link Resource#newResource(URL)} enables extensions to provide alternate resource implementations.
* @param uri the URI to convert to a Resource
* @return the Resource for that URI
* @throws IOException if unable to create a Resource from the URL
*/ */
public Resource newResource(URI uri) throws IOException public Resource newResource(URI uri) throws IOException
{ {

View File

@ -234,6 +234,7 @@ public class ContextHandlerCollection extends HandlerCollection
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */
/** Add a context handler. /** Add a context handler.
* @param contextPath The context path to add * @param contextPath The context path to add
* @param resourceBase the base (root) Resource
* @return the ContextHandler just added * @return the ContextHandler just added
*/ */
public ContextHandler addContext(String contextPath,String resourceBase) public ContextHandler addContext(String contextPath,String resourceBase)

View File

@ -35,14 +35,13 @@ import org.eclipse.jetty.util.annotation.ManagedAttribute;
import org.eclipse.jetty.util.annotation.ManagedObject; import org.eclipse.jetty.util.annotation.ManagedObject;
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */
/** A collection of handlers. /**
* A collection of handlers.
* <p> * <p>
* The default implementations calls all handlers in list order, * The default implementations calls all handlers in list order,
* regardless of the response status or exceptions. Derived implementation * regardless of the response status or exceptions. Derived implementation
* may alter the order or the conditions of calling the contained * may alter the order or the conditions of calling the contained
* handlers. * handlers.
* <p>
*
*/ */
@ManagedObject("Handler of multiple handlers") @ManagedObject("Handler of multiple handlers")
public class HandlerCollection extends AbstractHandlerContainer public class HandlerCollection extends AbstractHandlerContainer

View File

@ -90,12 +90,16 @@ public class HandlerWrapper extends AbstractHandlerContainer
} }
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */
/** Replace the current handler with another HandlerWrapper /**
* linked to the current handler. This is equivalent to:<pre> * Replace the current handler with another HandlerWrapper
* linked to the current handler.
* <p>
* This is equivalent to:
* <pre>
* wrapper.setHandler(getHandler()); * wrapper.setHandler(getHandler());
* setHandler(wrapper); * setHandler(wrapper);
* </pre> * </pre>
* @param wrapper * @param wrapper the wrapper to insert
*/ */
public void insertHandler(HandlerWrapper wrapper) public void insertHandler(HandlerWrapper wrapper)
{ {

View File

@ -57,12 +57,11 @@ import org.eclipse.jetty.util.log.Logger;
* are always applied, so that even if an entry matches the white list, a black list * are always applied, so that even if an entry matches the white list, a black list
* entry will override it. * entry will override it.
* <p> * <p>
* <p>
* You can change white list policy setting whiteListByPath to true. In this mode a request will be white listed * You can change white list policy setting whiteListByPath to true. In this mode a request will be white listed
* IF it has a matching URL in the white list, otherwise the black list applies, e.g. in default mode when * IF it has a matching URL in the white list, otherwise the black list applies, e.g. in default mode when
* whiteListByPath = false and wl = "127.0.0.1|/foo", /bar request from 127.0.0.1 will be blacklisted, * whiteListByPath = false and wl = "127.0.0.1|/foo", /bar request from 127.0.0.1 will be blacklisted,
* if whiteListByPath=true then not. * if whiteListByPath=true then not.
* </p> * <p>
* Internet addresses may be specified as absolute address or as a combination of * Internet addresses may be specified as absolute address or as a combination of
* four octet wildcard specifications (a.b.c.d) that are defined as follows. * four octet wildcard specifications (a.b.c.d) that are defined as follows.
* </p> * </p>
@ -70,9 +69,9 @@ import org.eclipse.jetty.util.log.Logger;
* nnn - an absolute value (0-255) * nnn - an absolute value (0-255)
* mmm-nnn - an inclusive range of absolute values, * mmm-nnn - an inclusive range of absolute values,
* with following shorthand notations: * with following shorthand notations:
* nnn- => nnn-255 * nnn- =&gt; nnn-255
* -nnn => 0-nnn * -nnn =&gt; 0-nnn
* - => 0-255 * - =&gt; 0-255
* a,b,... - a list of wildcard specifications * a,b,... - a list of wildcard specifications
* </pre> * </pre>
* <p> * <p>

View File

@ -33,13 +33,13 @@ import org.eclipse.jetty.server.Request;
* Handler to adjust the idle timeout of requests while dispatched. * Handler to adjust the idle timeout of requests while dispatched.
* Can be applied in jetty.xml with * Can be applied in jetty.xml with
* <pre> * <pre>
* &lt;Get id='handler' name='Handler'/> * &lt;Get id='handler' name='Handler'/&gt;
* &lt;Set name='Handler'> * &lt;Set name='Handler'&gt;
* &lt;New id='idleTimeoutHandler' class='org.eclipse.jetty.server.handler.IdleTimeoutHandler'> * &lt;New id='idleTimeoutHandler' class='org.eclipse.jetty.server.handler.IdleTimeoutHandler'&gt;
* &lt;Set name='Handler'>&lt;Ref id='handler'/>&lt;/Set> * &lt;Set name='Handler'&gt;&lt;Ref id='handler'/&gt;&lt;/Set&gt;
* &lt;Set name='IdleTimeoutMs'>5000&lt;/Set> * &lt;Set name='IdleTimeoutMs'&gt;5000&lt;/Set&gt;
* &lt;/New> * &lt;/New&gt;
* &lt;/Set> * &lt;/Set&gt;
* </pre> * </pre>
*/ */
public class IdleTimeoutHandler extends HandlerWrapper public class IdleTimeoutHandler extends HandlerWrapper

View File

@ -598,9 +598,9 @@ public class ResourceHandler extends HandlerWrapper
/** Set the response headers. /** Set the response headers.
* This method is called to set the response headers such as content type and content length. * This method is called to set the response headers such as content type and content length.
* May be extended to add additional headers. * May be extended to add additional headers.
* @param response * @param response the http response
* @param resource * @param resource the resource
* @param mimeType * @param mimeType the mime type
*/ */
protected void doResponseHeaders(HttpServletResponse response, Resource resource, String mimeType) protected void doResponseHeaders(HttpServletResponse response, Resource resource, String mimeType)
{ {

View File

@ -40,7 +40,7 @@ import org.eclipse.jetty.server.Request;
* {@link #doHandle(String, Request, HttpServletRequest, HttpServletResponse)} method * {@link #doHandle(String, Request, HttpServletRequest, HttpServletResponse)} method
* is called on all contained handlers.</p> * is called on all contained handlers.</p>
* *
* <p>For example if Scoped handlers A, B & C were chained together, then * <p>For example if Scoped handlers A, B &amp; C were chained together, then
* the calling order would be:</p> * the calling order would be:</p>
* <pre> * <pre>
* A.handle(...) * A.handle(...)
@ -52,7 +52,7 @@ import org.eclipse.jetty.server.Request;
* C.doHandle(...) * C.doHandle(...)
* </pre> * </pre>
* *
* <p>If non scoped handler X was in the chained A, B, X & C, then * <p>If non scoped handler X was in the chained A, B, X &amp; C, then
* the calling order would be:</p> * the calling order would be:</p>
* <pre> * <pre>
* A.handle(...) * A.handle(...)

View File

@ -46,12 +46,11 @@ import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger; import org.eclipse.jetty.util.log.Logger;
/* ------------------------------------------------------------ */
/** /**
* A Handler that can dynamically GZIP compress responses. Unlike * A Handler that can dynamically GZIP compress responses. Unlike
* previous and 3rd party GzipFilters, this mechanism works with asynchronously * previous and 3rd party GzipFilters, this mechanism works with asynchronously
* generated responses and does not need to wrap the response or it's output * generated responses and does not need to wrap the response or it's output
* stream. Instead it uses the efficient {@link HttpOutput.Interceptor} mechanism. * stream. Instead it uses the efficient {@link org.eclipse.jetty.server.HttpOutput.Interceptor} mechanism.
* <p> * <p>
* The handler can be applied to the entire server (a gzip.mod is included in * The handler can be applied to the entire server (a gzip.mod is included in
* the distribution) or it may be applied to individual contexts. * the distribution) or it may be applied to individual contexts.

View File

@ -98,6 +98,7 @@ public abstract class AbstractSession implements AbstractSessionManager.SessionI
/* ------------------------------------------------------------- */ /* ------------------------------------------------------------- */
/** /**
* asserts that the session is valid * asserts that the session is valid
* @throws IllegalStateException if the sesion is invalid
*/ */
protected void checkValid() throws IllegalStateException protected void checkValid() throws IllegalStateException
{ {
@ -107,8 +108,8 @@ public abstract class AbstractSession implements AbstractSessionManager.SessionI
/* ------------------------------------------------------------- */ /* ------------------------------------------------------------- */
/** Check to see if session has expired as at the time given. /** Check to see if session has expired as at the time given.
* @param time * @param time the time in milliseconds
* @return * @return true if expired
*/ */
protected boolean checkExpiry(long time) protected boolean checkExpiry(long time)
{ {
@ -470,11 +471,12 @@ public abstract class AbstractSession implements AbstractSessionManager.SessionI
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */
/** /**
* @param name * @param name the name of the attribute
* @param value * @param value the value of the attribute
* @return true if attribute changed
* @deprecated use changeAttribute(String,Object) instead * @deprecated use changeAttribute(String,Object) instead
* @return
*/ */
@Deprecated
protected boolean updateAttribute (String name, Object value) protected boolean updateAttribute (String name, Object value)
{ {
Object old=null; Object old=null;
@ -504,9 +506,9 @@ public abstract class AbstractSession implements AbstractSessionManager.SessionI
* in the session. The appropriate session attribute listeners are * in the session. The appropriate session attribute listeners are
* also called. * also called.
* *
* @param name * @param name the name of the attribute
* @param value * @param value the value of the attribute
* @return * @return the old value for the attribute
*/ */
protected Object changeAttribute (String name, Object value) protected Object changeAttribute (String name, Object value)
{ {
@ -566,7 +568,11 @@ public abstract class AbstractSession implements AbstractSessionManager.SessionI
} }
/* ------------------------------------------------------------- */ /* ------------------------------------------------------------- */
/** If value implements HttpSessionBindingListener, call valueBound() */ /**
* Bind value if value implements {@link HttpSessionBindingListener} (calls {@link HttpSessionBindingListener#valueBound(HttpSessionBindingEvent)})
* @param name the name with which the object is bound or unbound
* @param value the bound value
*/
public void bindValue(java.lang.String name, Object value) public void bindValue(java.lang.String name, Object value)
{ {
if (value!=null&&value instanceof HttpSessionBindingListener) if (value!=null&&value instanceof HttpSessionBindingListener)
@ -607,7 +613,11 @@ public abstract class AbstractSession implements AbstractSessionManager.SessionI
} }
/* ------------------------------------------------------------- */ /* ------------------------------------------------------------- */
/** If value implements HttpSessionBindingListener, call valueUnbound() */ /**
* Unbind value if value implements {@link HttpSessionBindingListener} (calls {@link HttpSessionBindingListener#valueUnbound(HttpSessionBindingEvent)})
* @param name the name with which the object is bound or unbound
* @param value the bound value
*/
public void unbindValue(java.lang.String name, Object value) public void unbindValue(java.lang.String name, Object value)
{ {
if (value!=null&&value instanceof HttpSessionBindingListener) if (value!=null&&value instanceof HttpSessionBindingListener)

View File

@ -67,13 +67,13 @@ public abstract class AbstractSessionIdManager extends AbstractLifeCycle impleme
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */
/** /**
* Set the workname. If set, the workername is dot appended to the session * Set the workername. If set, the workername is dot appended to the session
* ID and can be used to assist session affinity in a load balancer. * ID and can be used to assist session affinity in a load balancer.
* A worker name starting with $ is used as a request attribute name to * A worker name starting with $ is used as a request attribute name to
* lookup the worker name that can be dynamically set by a request * lookup the worker name that can be dynamically set by a request
* customiser. * Customizer.
* *
* @param workerName * @param workerName the name of the worker
*/ */
public void setWorkerName(String workerName) public void setWorkerName(String workerName)
{ {
@ -244,8 +244,8 @@ public abstract class AbstractSessionIdManager extends AbstractLifeCycle impleme
/** Get the session ID with any worker ID. /** Get the session ID with any worker ID.
* *
* @param clusterId * @param clusterId the cluster id
* @param request * @param request the request
* @return sessionId plus any worker ID. * @return sessionId plus any worker ID.
*/ */
@Override @Override

View File

@ -53,15 +53,12 @@ import org.eclipse.jetty.util.log.Logger;
import org.eclipse.jetty.util.statistic.CounterStatistic; import org.eclipse.jetty.util.statistic.CounterStatistic;
import org.eclipse.jetty.util.statistic.SampleStatistic; import org.eclipse.jetty.util.statistic.SampleStatistic;
/* ------------------------------------------------------------ */
/** /**
* An Abstract implementation of SessionManager. The partial implementation of * An Abstract implementation of SessionManager.
* SessionManager interface provides the majority of the handling required to
* implement a SessionManager. Concrete implementations of SessionManager based
* on AbstractSessionManager need only implement the newSession method to return
* a specialised version of the Session inner class that provides an attribute
* Map.
* <p> * <p>
* The partial implementation of SessionManager interface provides the majority of the handling required to implement a
* SessionManager. Concrete implementations of SessionManager based on AbstractSessionManager need only implement the
* newSession method to return a specialized version of the Session inner class that provides an attribute Map.
*/ */
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
@ManagedObject("Abstract Session Manager") @ManagedObject("Abstract Session Manager")
@ -405,6 +402,7 @@ public abstract class AbstractSessionManager extends ContainerLifeCycle implemen
/** /**
* HTTPS request. Can be overridden by setting SessionCookieConfig.setSecure(true), * HTTPS request. Can be overridden by setting SessionCookieConfig.setSecure(true),
* in which case the session cookie will be marked as secure on both HTTPS and HTTP. * in which case the session cookie will be marked as secure on both HTTPS and HTTP.
* @param secureRequestOnly true to set Session Cookie Config as secure
*/ */
public void setSecureRequestOnly(boolean secureRequestOnly) public void setSecureRequestOnly(boolean secureRequestOnly)
{ {
@ -423,7 +421,7 @@ public abstract class AbstractSessionManager extends ContainerLifeCycle implemen
* A sessioncookie is marked as secure IFF any of the following conditions are true: * A sessioncookie is marked as secure IFF any of the following conditions are true:
* <ol> * <ol>
* <li>SessionCookieConfig.setSecure == true</li> * <li>SessionCookieConfig.setSecure == true</li>
* <li>SessionCookieConfig.setSecure == false && _secureRequestOnly==true && request is HTTPS</li> * <li>SessionCookieConfig.setSecure == false &amp;&amp; _secureRequestOnly==true &amp;&amp; request is HTTPS</li>
* </ol> * </ol>
* According to SessionCookieConfig javadoc, case 1 can be used when: * According to SessionCookieConfig javadoc, case 1 can be used when:
* "... even though the request that initiated the session came over HTTP, * "... even though the request that initiated the session came over HTTP,
@ -431,14 +429,16 @@ public abstract class AbstractSessionManager extends ContainerLifeCycle implemen
* SSL offloading load balancer. In this case, the traffic between the client * SSL offloading load balancer. In this case, the traffic between the client
* and the load balancer will be over HTTPS, whereas the traffic between the * and the load balancer will be over HTTPS, whereas the traffic between the
* load balancer and the web container will be over HTTP." * load balancer and the web container will be over HTTP."
* * <p>
* For case 2, you can use _secureRequestOnly to determine if you want the * For case 2, you can use _secureRequestOnly to determine if you want the
* Servlet Spec 3.0 default behaviour when SessionCookieConfig.setSecure==false, * Servlet Spec 3.0 default behavior when SessionCookieConfig.setSecure==false,
* which is: * which is:
* <cite>
* "they shall be marked as secure only if the request that initiated the * "they shall be marked as secure only if the request that initiated the
* corresponding session was also secure" * corresponding session was also secure"
* * </cite>
* The default for _secureRequestOnly is true, which gives the above behaviour. If * <p>
* The default for _secureRequestOnly is true, which gives the above behavior. If
* you set it to false, then a session cookie is NEVER marked as secure, even if * you set it to false, then a session cookie is NEVER marked as secure, even if
* the initiating request was secure. * the initiating request was secure.
* *
@ -612,9 +612,6 @@ public abstract class AbstractSessionManager extends ContainerLifeCycle implemen
} }
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */
/**
* @param seconds
*/
@Override @Override
public void setMaxInactiveInterval(int seconds) public void setMaxInactiveInterval(int seconds)
{ {
@ -669,6 +666,8 @@ public abstract class AbstractSessionManager extends ContainerLifeCycle implemen
/** /**
* Add the session Registers the session with this manager and registers the * Add the session Registers the session with this manager and registers the
* session ID with the sessionIDManager; * session ID with the sessionIDManager;
* @param session the session
* @param created true if session was created
*/ */
protected void addSession(AbstractSession session, boolean created) protected void addSession(AbstractSession session, boolean created)
{ {
@ -701,7 +700,7 @@ public abstract class AbstractSessionManager extends ContainerLifeCycle implemen
/** /**
* Prepare sessions for session manager shutdown * Prepare sessions for session manager shutdown
* *
* @throws Exception * @throws Exception if unable to shutdown sesssions
*/ */
protected abstract void shutdownSessions() throws Exception; protected abstract void shutdownSessions() throws Exception;
@ -709,7 +708,7 @@ public abstract class AbstractSessionManager extends ContainerLifeCycle implemen
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */
/** /**
* Create a new session instance * Create a new session instance
* @param request * @param request the request to build the session from
* @return the new session * @return the new session
*/ */
protected abstract AbstractSession newSession(HttpServletRequest request); protected abstract AbstractSession newSession(HttpServletRequest request);
@ -746,10 +745,12 @@ public abstract class AbstractSessionManager extends ContainerLifeCycle implemen
} }
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */
/** Remove session from manager /**
* Remove session from manager
* @param session The session to remove * @param session The session to remove
* @param invalidate True if {@link HttpSessionListener#sessionDestroyed(HttpSessionEvent)} and * @param invalidate True if {@link HttpSessionListener#sessionDestroyed(HttpSessionEvent)} and
* {@link SessionIdManager#invalidateAll(String)} should be called. * {@link SessionIdManager#invalidateAll(String)} should be called.
* @return if the session was removed
*/ */
public boolean removeSession(AbstractSession session, boolean invalidate) public boolean removeSession(AbstractSession session, boolean invalidate)
{ {

View File

@ -64,6 +64,7 @@ public class HashSessionIdManager extends AbstractSessionIdManager
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */
/** /**
* @param id the id of the session
* @return Collection of Sessions for the passed session ID * @return Collection of Sessions for the passed session ID
*/ */
public Collection<HttpSession> getSession(String id) public Collection<HttpSession> getSession(String id)

View File

@ -245,6 +245,7 @@ public class HashedSession extends MemSession
* *
* The session is idled by persisting it, then clearing the session values attribute map and finally setting * The session is idled by persisting it, then clearing the session values attribute map and finally setting
* it to an idled state. * it to an idled state.
* @throws Exception if unable to save session
*/ */
public synchronized void idle() public synchronized void idle()
throws Exception throws Exception

View File

@ -530,7 +530,7 @@ public class JDBCSessionIdManager extends AbstractSessionIdManager
* Convert a camel case identifier into either upper or lower * Convert a camel case identifier into either upper or lower
* depending on the way the db stores identifiers. * depending on the way the db stores identifiers.
* *
* @param identifier * @param identifier the raw identifier
* @return the converted identifier * @return the converted identifier
*/ */
public String convertIdentifier (String identifier) public String convertIdentifier (String identifier)
@ -629,8 +629,8 @@ public class JDBCSessionIdManager extends AbstractSessionIdManager
/** /**
* Configure jdbc connection information via a jdbc Driver * Configure jdbc connection information via a jdbc Driver
* *
* @param driverClassName * @param driverClassName the driver classname
* @param connectionUrl * @param connectionUrl the driver connection url
*/ */
public void setDriverInfo (String driverClassName, String connectionUrl) public void setDriverInfo (String driverClassName, String connectionUrl)
{ {
@ -641,8 +641,8 @@ public class JDBCSessionIdManager extends AbstractSessionIdManager
/** /**
* Configure jdbc connection information via a jdbc Driver * Configure jdbc connection information via a jdbc Driver
* *
* @param driverClass * @param driverClass the driver class
* @param connectionUrl * @param connectionUrl the driver connection url
*/ */
public void setDriverInfo (Driver driverClass, String connectionUrl) public void setDriverInfo (Driver driverClass, String connectionUrl)
{ {
@ -682,9 +682,10 @@ public class JDBCSessionIdManager extends AbstractSessionIdManager
} }
/** /**
* @param name * @param name the name of the blob
* @deprecated see DbAdaptor.setBlobType * @deprecated see DbAdaptor.setBlobType
*/ */
@Deprecated
public void setBlobType (String name) public void setBlobType (String name)
{ {
_dbAdaptor.setBlobType(name); _dbAdaptor.setBlobType(name);
@ -704,27 +705,30 @@ public class JDBCSessionIdManager extends AbstractSessionIdManager
} }
/** /**
* @return * @return the blob type
* @deprecated see DbAdaptor.getBlobType * @deprecated see DbAdaptor.getBlobType
*/ */
@Deprecated
public String getBlobType () public String getBlobType ()
{ {
return _dbAdaptor.getBlobType(); return _dbAdaptor.getBlobType();
} }
/** /**
* @return * @return the long type
* @deprecated see DbAdaptor.getLogType * @deprecated see DbAdaptor.getLogType
*/ */
@Deprecated
public String getLongType() public String getLongType()
{ {
return _dbAdaptor.getLongType(); return _dbAdaptor.getLongType();
} }
/** /**
* @param longType * @param longType the long type
* @deprecated see DbAdaptor.setLongType * @deprecated see DbAdaptor.setLongType
*/ */
@Deprecated
public void setLongType(String longType) public void setLongType(String longType)
{ {
_dbAdaptor.setLongType(longType); _dbAdaptor.setLongType(longType);
@ -1026,7 +1030,7 @@ public class JDBCSessionIdManager extends AbstractSessionIdManager
* Get a connection from the driver or datasource. * Get a connection from the driver or datasource.
* *
* @return the connection for the datasource * @return the connection for the datasource
* @throws SQLException * @throws SQLException if unable to get the connection
*/ */
protected Connection getConnection () protected Connection getConnection ()
throws SQLException throws SQLException
@ -1036,11 +1040,6 @@ public class JDBCSessionIdManager extends AbstractSessionIdManager
else else
return DriverManager.getConnection(_connectionUrl); return DriverManager.getConnection(_connectionUrl);
} }
/** /**
* Set up the tables in the database * Set up the tables in the database

View File

@ -48,23 +48,24 @@ import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger; import org.eclipse.jetty.util.log.Logger;
/** /**
* JDBCSessionManager * JDBCSessionManager.
* * <p>
* SessionManager that persists sessions to a database to enable clustering. * SessionManager that persists sessions to a database to enable clustering.
* * <p>
* Session data is persisted to the JettySessions table: * Session data is persisted to the JettySessions table:
* * <dl>
* rowId (unique in cluster: webapp name/path + virtualhost + sessionId) * <dt>rowId</dt><dd>(unique in cluster: webapp name/path + virtualhost + sessionId)</dd>
* contextPath (of the context owning the session) * <dt>contextPath</dt><dd>(of the context owning the session)</dd>
* sessionId (unique in a context) * <dt>sessionId</dt><dd>(unique in a context)</dd>
* lastNode (name of node last handled session) * <dt>lastNode</dt><dd>(name of node last handled session)</dd>
* accessTime (time in milliseconds session was accessed) * <dt>accessTime</dt><dd>(time in milliseconds session was accessed)</dd>
* lastAccessTime (previous time in milliseconds session was accessed) * <dt>lastAccessTime</dt><dd>(previous time in milliseconds session was accessed)</dd>
* createTime (time in milliseconds session created) * <dt>createTime</dt><dd>(time in milliseconds session created)</dd>
* cookieTime (time in milliseconds session cookie created) * <dt>cookieTime</dt><dd>(time in milliseconds session cookie created)</dd>
* lastSavedTime (last time in milliseconds session access times were saved) * <dt>lastSavedTime</dt><dd>(last time in milliseconds session access times were saved)</dd>
* expiryTime (time in milliseconds that the session is due to expire) * <dt>expiryTime</dt><dd>(time in milliseconds that the session is due to expire)</dd>
* map (attribute map) * <dt>map</dt><dd>(attribute map)</dd>
* </dl>
* *
* As an optimization, to prevent thrashing the database, we do not persist * As an optimization, to prevent thrashing the database, we do not persist
* the accessTime and lastAccessTime every time the session is accessed. Rather, * the accessTime and lastAccessTime every time the session is accessed. Rather,
@ -140,7 +141,7 @@ public class JDBCSessionManager extends AbstractSessionManager
/** /**
* Session from a request. * Session from a request.
* *
* @param request * @param request the request
*/ */
protected Session (HttpServletRequest request) protected Session (HttpServletRequest request)
{ {
@ -155,10 +156,11 @@ public class JDBCSessionManager extends AbstractSessionManager
/** /**
* Session restored from database * Session restored from database
* @param sessionId * @param sessionId the session id
* @param rowId * @param rowId the row id
* @param created * @param created the created timestamp
* @param accessed * @param accessed the access timestamp
* @param maxInterval the max inactive interval (in seconds)
*/ */
protected Session (String sessionId, String rowId, long created, long accessed, long maxInterval) protected Session (String sessionId, String rowId, long created, long accessed, long maxInterval)
{ {
@ -407,7 +409,7 @@ public class JDBCSessionManager extends AbstractSessionManager
* If any session attribute does change, then the attributes and * If any session attribute does change, then the attributes and
* the accessed time are persisted. * the accessed time are persisted.
* *
* @param sec * @param sec the save interval in seconds
*/ */
public void setSaveInterval (long sec) public void setSaveInterval (long sec)
{ {
@ -430,7 +432,7 @@ public class JDBCSessionManager extends AbstractSessionManager
* This could be used eg with a JMS backplane to notify nodes * This could be used eg with a JMS backplane to notify nodes
* that the session has changed and to delete the session from * that the session has changed and to delete the session from
* the node's cache, and re-read it from the database. * the node's cache, and re-read it from the database.
* @param session * @param session the session to invalidate
*/ */
public void cacheInvalidate (Session session) public void cacheInvalidate (Session session)
{ {
@ -693,7 +695,7 @@ public class JDBCSessionManager extends AbstractSessionManager
/** /**
* Invalidate a session. * Invalidate a session.
* *
* @param idInCluster * @param idInCluster the id in the cluster
*/ */
protected void invalidateSession (String idInCluster) protected void invalidateSession (String idInCluster)
{ {
@ -768,15 +770,6 @@ public class JDBCSessionManager extends AbstractSessionManager
return new Session(request); return new Session(request);
} }
/**
* @param sessionId
* @param rowId
* @param created
* @param accessed
* @param maxInterval
* @return
*/
protected AbstractSession newSession (String sessionId, String rowId, long created, long accessed, long maxInterval) protected AbstractSession newSession (String sessionId, String rowId, long created, long accessed, long maxInterval)
{ {
return new Session(sessionId, rowId, created, accessed, maxInterval); return new Session(sessionId, rowId, created, accessed, maxInterval);
@ -810,7 +803,8 @@ public class JDBCSessionManager extends AbstractSessionManager
* Expire any Sessions we have in memory matching the list of * Expire any Sessions we have in memory matching the list of
* expired Session ids. * expired Session ids.
* *
* @param sessionIds * @param sessionIds the session ids to expire
* @return the set of successfully expired ids
*/ */
protected Set<String> expire (Set<String> sessionIds) protected Set<String> expire (Set<String> sessionIds)
{ {
@ -875,9 +869,11 @@ public class JDBCSessionManager extends AbstractSessionManager
/** /**
* Load a session from the database * Load a session from the database
* @param id * @param id the id
* @param canonicalContextPath the canonical context path
* @param vhost the virtual host
* @return the session data that was loaded * @return the session data that was loaded
* @throws Exception * @throws Exception if unable to load the session
*/ */
protected Session loadSession (final String id, final String canonicalContextPath, final String vhost) protected Session loadSession (final String id, final String canonicalContextPath, final String vhost)
throws Exception throws Exception
@ -957,8 +953,8 @@ public class JDBCSessionManager extends AbstractSessionManager
/** /**
* Insert a session into the database. * Insert a session into the database.
* *
* @param session * @param session the session
* @throws Exception * @throws Exception if unable to store the session
*/ */
protected void storeSession (Session session) protected void storeSession (Session session)
throws Exception throws Exception
@ -1010,7 +1006,7 @@ public class JDBCSessionManager extends AbstractSessionManager
* Update data on an existing persisted session. * Update data on an existing persisted session.
* *
* @param data the session * @param data the session
* @throws Exception * @throws Exception if unable to update the session
*/ */
protected void updateSession (Session data) protected void updateSession (Session data)
throws Exception throws Exception
@ -1053,7 +1049,7 @@ public class JDBCSessionManager extends AbstractSessionManager
* Update the node on which the session was last seen to be my node. * Update the node on which the session was last seen to be my node.
* *
* @param data the session * @param data the session
* @throws Exception * @throws Exception if unable to update the session node
*/ */
protected void updateSessionNode (Session data) protected void updateSessionNode (Session data)
throws Exception throws Exception
@ -1107,8 +1103,8 @@ public class JDBCSessionManager extends AbstractSessionManager
* Delete a session from the database. Should only be called * Delete a session from the database. Should only be called
* when the session has been invalidated. * when the session has been invalidated.
* *
* @param data * @param data the session data
* @throws Exception * @throws Exception if unable to delete the session
*/ */
protected void deleteSession (Session data) protected void deleteSession (Session data)
throws Exception throws Exception

View File

@ -228,8 +228,8 @@ public class SessionHandler extends ScopedHandler
/** /**
* Look for a requested session ID in cookies and URI parameters * Look for a requested session ID in cookies and URI parameters
* *
* @param baseRequest * @param baseRequest the request to check
* @param request * @param request the request to check
*/ */
protected void checkRequestedSessionId(Request baseRequest, HttpServletRequest request) protected void checkRequestedSessionId(Request baseRequest, HttpServletRequest request)
{ {
@ -321,9 +321,6 @@ public class SessionHandler extends ScopedHandler
} }
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */
/**
* @param listener
*/
public void addEventListener(EventListener listener) public void addEventListener(EventListener listener)
{ {
if (_sessionManager != null) if (_sessionManager != null)
@ -331,9 +328,6 @@ public class SessionHandler extends ScopedHandler
} }
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */
/**
* @param listener
*/
public void removeEventListener(EventListener listener) public void removeEventListener(EventListener listener)
{ {
if (_sessionManager != null) if (_sessionManager != null)

View File

@ -56,9 +56,6 @@ import org.junit.Assert;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
/**
*
*/
public class HttpConnectionTest public class HttpConnectionTest
{ {
private Server server; private Server server;
@ -686,6 +683,7 @@ public class HttpConnectionTest
/** /**
* Creates a request header over 1k in size, by creating a single header entry with an huge value. * Creates a request header over 1k in size, by creating a single header entry with an huge value.
* @throws Exception if test failure
*/ */
@Test @Test
public void testOversizedBuffer() throws Exception public void testOversizedBuffer() throws Exception
@ -714,6 +712,7 @@ public class HttpConnectionTest
/** /**
* Creates a request header with over 1000 entries. * Creates a request header with over 1000 entries.
* @throws Exception if test failure
*/ */
@Test @Test
public void testExcessiveHeader() throws Exception public void testExcessiveHeader() throws Exception

View File

@ -376,6 +376,7 @@ public class RequestLogHandlerTest
/** /**
* Test a RequestLogHandler at the end of a HandlerCollection. all other configuration on server at defaults. * Test a RequestLogHandler at the end of a HandlerCollection. all other configuration on server at defaults.
* @throws Exception if test failure
*/ */
@Test(timeout = 4000) @Test(timeout = 4000)
public void testLogHandlerCollection() throws Exception public void testLogHandlerCollection() throws Exception
@ -439,6 +440,7 @@ public class RequestLogHandlerTest
/** /**
* Test a RequestLogHandler at the end of a HandlerCollection and also with the default ErrorHandler as server bean in place. * Test a RequestLogHandler at the end of a HandlerCollection and also with the default ErrorHandler as server bean in place.
* @throws Exception if test failure
*/ */
@Test(timeout = 4000) @Test(timeout = 4000)
public void testLogHandlerCollection_ErrorHandler_ServerBean() throws Exception public void testLogHandlerCollection_ErrorHandler_ServerBean() throws Exception
@ -505,6 +507,7 @@ public class RequestLogHandlerTest
/** /**
* Test a RequestLogHandler at the end of a HandlerCollection and also with the ErrorHandler in place. * Test a RequestLogHandler at the end of a HandlerCollection and also with the ErrorHandler in place.
* @throws Exception if test failure
*/ */
@Test(timeout=4000) @Test(timeout=4000)
public void testLogHandlerCollection_AltErrorHandler() throws Exception public void testLogHandlerCollection_AltErrorHandler() throws Exception
@ -578,6 +581,7 @@ public class RequestLogHandlerTest
/** /**
* Test a RequestLogHandler at the end of a HandlerCollection and also with the ErrorHandler in place. * Test a RequestLogHandler at the end of a HandlerCollection and also with the ErrorHandler in place.
* @throws Exception if test failure
*/ */
@Test(timeout=4000) @Test(timeout=4000)
public void testLogHandlerCollection_OKErrorHandler() throws Exception public void testLogHandlerCollection_OKErrorHandler() throws Exception
@ -651,6 +655,7 @@ public class RequestLogHandlerTest
/** /**
* Test a RequestLogHandler at the end of a HandlerCollection and also with the ErrorHandler in place. * Test a RequestLogHandler at the end of a HandlerCollection and also with the ErrorHandler in place.
* @throws Exception if test failure
*/ */
@Test(timeout=4000) @Test(timeout=4000)
public void testLogHandlerCollection_DispatchErrorHandler() throws Exception public void testLogHandlerCollection_DispatchErrorHandler() throws Exception

View File

@ -31,24 +31,14 @@ import javax.servlet.http.HttpSession;
import org.eclipse.jetty.http.HttpCookie; import org.eclipse.jetty.http.HttpCookie;
import org.junit.Test; import org.junit.Test;
/** /**
* SessionCookieTest * SessionCookieTest
*
*
*/ */
public class SessionCookieTest public class SessionCookieTest
{ {
public class MockSession extends AbstractSession public class MockSession extends AbstractSession
{ {
/**
* @param abstractSessionManager
* @param created
* @param accessed
* @param clusterId
*/
protected MockSession(AbstractSessionManager abstractSessionManager, long created, long accessed, String clusterId) protected MockSession(AbstractSessionManager abstractSessionManager, long created, long accessed, String clusterId)
{ {
super(abstractSessionManager, created, accessed, clusterId); super(abstractSessionManager, created, accessed, clusterId);
@ -72,9 +62,6 @@ public class SessionCookieTest
return null; return null;
} }
/**
* @see javax.servlet.http.HttpSession#getValueNames()
*/
@Override @Override
public String[] getValueNames() public String[] getValueNames()
{ {