464727 - Update Javadoc for Java 8 DocLint
This commit is contained in:
parent
9e6c8eade1
commit
c9d8d07a63
|
@ -309,6 +309,9 @@ public class HttpClient extends ContainerLifeCycle
|
||||||
*
|
*
|
||||||
* @param uri the URI to GET
|
* @param uri the URI to GET
|
||||||
* @return the {@link ContentResponse} for the request
|
* @return the {@link ContentResponse} for the request
|
||||||
|
* @throws InterruptedException if send threading has been interrupted
|
||||||
|
* @throws ExecutionException the execution failed
|
||||||
|
* @throws TimeoutException the send timed out
|
||||||
* @see #GET(URI)
|
* @see #GET(URI)
|
||||||
*/
|
*/
|
||||||
public ContentResponse GET(String uri) throws InterruptedException, ExecutionException, TimeoutException
|
public ContentResponse GET(String uri) throws InterruptedException, ExecutionException, TimeoutException
|
||||||
|
@ -321,6 +324,9 @@ public class HttpClient extends ContainerLifeCycle
|
||||||
*
|
*
|
||||||
* @param uri the URI to GET
|
* @param uri the URI to GET
|
||||||
* @return the {@link ContentResponse} for the request
|
* @return the {@link ContentResponse} for the request
|
||||||
|
* @throws InterruptedException if send threading has been interrupted
|
||||||
|
* @throws ExecutionException the execution failed
|
||||||
|
* @throws TimeoutException the send timed out
|
||||||
* @see #newRequest(URI)
|
* @see #newRequest(URI)
|
||||||
*/
|
*/
|
||||||
public ContentResponse GET(URI uri) throws InterruptedException, ExecutionException, TimeoutException
|
public ContentResponse GET(URI uri) throws InterruptedException, ExecutionException, TimeoutException
|
||||||
|
@ -334,6 +340,9 @@ public class HttpClient extends ContainerLifeCycle
|
||||||
* @param uri the URI to POST
|
* @param uri the URI to POST
|
||||||
* @param fields the fields composing the form name/value pairs
|
* @param fields the fields composing the form name/value pairs
|
||||||
* @return the {@link ContentResponse} for the request
|
* @return the {@link ContentResponse} for the request
|
||||||
|
* @throws InterruptedException if send threading has been interrupted
|
||||||
|
* @throws ExecutionException the execution failed
|
||||||
|
* @throws TimeoutException the send timed out
|
||||||
*/
|
*/
|
||||||
public ContentResponse FORM(String uri, Fields fields) throws InterruptedException, ExecutionException, TimeoutException
|
public ContentResponse FORM(String uri, Fields fields) throws InterruptedException, ExecutionException, TimeoutException
|
||||||
{
|
{
|
||||||
|
@ -346,6 +355,9 @@ public class HttpClient extends ContainerLifeCycle
|
||||||
* @param uri the URI to POST
|
* @param uri the URI to POST
|
||||||
* @param fields the fields composing the form name/value pairs
|
* @param fields the fields composing the form name/value pairs
|
||||||
* @return the {@link ContentResponse} for the request
|
* @return the {@link ContentResponse} for the request
|
||||||
|
* @throws InterruptedException if send threading has been interrupted
|
||||||
|
* @throws ExecutionException the execution failed
|
||||||
|
* @throws TimeoutException the send timed out
|
||||||
*/
|
*/
|
||||||
public ContentResponse FORM(URI uri, Fields fields) throws InterruptedException, ExecutionException, TimeoutException
|
public ContentResponse FORM(URI uri, Fields fields) throws InterruptedException, ExecutionException, TimeoutException
|
||||||
{
|
{
|
||||||
|
|
|
@ -42,7 +42,7 @@ import org.eclipse.jetty.util.log.Logger;
|
||||||
* | | | | | | | | | |
|
* | | | | | | | | | |
|
||||||
* +---+ +---+ +---+ +---+ +---+
|
* +---+ +---+ +---+ +---+ +---+
|
||||||
* ^ ^ ^ ^
|
* ^ ^ ^ ^
|
||||||
* | | --> advance() | |
|
* | | --> advance() | |
|
||||||
* | | last |
|
* | | last |
|
||||||
* | | |
|
* | | |
|
||||||
* before | after
|
* before | after
|
||||||
|
|
|
@ -41,42 +41,42 @@ public class HttpConversation extends AttributesMap
|
||||||
* This list changes as the conversation proceeds, as follows:
|
* This list changes as the conversation proceeds, as follows:
|
||||||
* <ol>
|
* <ol>
|
||||||
* <li>
|
* <li>
|
||||||
* request R1 send => conversation.updateResponseListeners(null)
|
* request R1 send => conversation.updateResponseListeners(null)
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li>exchanges in conversation: E1</li>
|
* <li>exchanges in conversation: E1</li>
|
||||||
* <li>listeners to be notified: E1.listeners</li>
|
* <li>listeners to be notified: E1.listeners</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
* </li>
|
* </li>
|
||||||
* <li>
|
* <li>
|
||||||
* response R1 arrived, 401 => conversation.updateResponseListeners(AuthenticationProtocolHandler.listener)
|
* response R1 arrived, 401 => conversation.updateResponseListeners(AuthenticationProtocolHandler.listener)
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li>exchanges in conversation: E1</li>
|
* <li>exchanges in conversation: E1</li>
|
||||||
* <li>listeners to be notified: AuthenticationProtocolHandler.listener</li>
|
* <li>listeners to be notified: AuthenticationProtocolHandler.listener</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
* </li>
|
* </li>
|
||||||
* <li>
|
* <li>
|
||||||
* request R2 send => conversation.updateResponseListeners(null)
|
* request R2 send => conversation.updateResponseListeners(null)
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li>exchanges in conversation: E1 + E2</li>
|
* <li>exchanges in conversation: E1 + E2</li>
|
||||||
* <li>listeners to be notified: E2.listeners + E1.listeners</li>
|
* <li>listeners to be notified: E2.listeners + E1.listeners</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
* </li>
|
* </li>
|
||||||
* <li>
|
* <li>
|
||||||
* response R2 arrived, 302 => conversation.updateResponseListeners(RedirectProtocolHandler.listener)
|
* response R2 arrived, 302 => conversation.updateResponseListeners(RedirectProtocolHandler.listener)
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li>exchanges in conversation: E1 + E2</li>
|
* <li>exchanges in conversation: E1 + E2</li>
|
||||||
* <li>listeners to be notified: E2.listeners + RedirectProtocolHandler.listener</li>
|
* <li>listeners to be notified: E2.listeners + RedirectProtocolHandler.listener</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
* </li>
|
* </li>
|
||||||
* <li>
|
* <li>
|
||||||
* request R3 send => conversation.updateResponseListeners(null)
|
* request R3 send => conversation.updateResponseListeners(null)
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li>exchanges in conversation: E1 + E2 + E3</li>
|
* <li>exchanges in conversation: E1 + E2 + E3</li>
|
||||||
* <li>listeners to be notified: E3.listeners + E1.listeners</li>
|
* <li>listeners to be notified: E3.listeners + E1.listeners</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
* </li>
|
* </li>
|
||||||
* <li>
|
* <li>
|
||||||
* response R3 arrived, 200 => conversation.updateResponseListeners(null)
|
* response R3 arrived, 200 => conversation.updateResponseListeners(null)
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li>exchanges in conversation: E1 + E2 + E3</li>
|
* <li>exchanges in conversation: E1 + E2 + E3</li>
|
||||||
* <li>listeners to be notified: E3.listeners + E1.listeners</li>
|
* <li>listeners to be notified: E3.listeners + E1.listeners</li>
|
||||||
|
|
|
@ -286,6 +286,7 @@ public abstract class HttpReceiver
|
||||||
*
|
*
|
||||||
* @param exchange the HTTP exchange
|
* @param exchange the HTTP exchange
|
||||||
* @param buffer the response HTTP content buffer
|
* @param buffer the response HTTP content buffer
|
||||||
|
* @param callback the callback
|
||||||
* @return whether the processing should continue
|
* @return whether the processing should continue
|
||||||
*/
|
*/
|
||||||
protected boolean responseContent(HttpExchange exchange, ByteBuffer buffer, final Callback callback)
|
protected boolean responseContent(HttpExchange exchange, ByteBuffer buffer, final Callback callback)
|
||||||
|
|
|
@ -41,9 +41,9 @@ import org.eclipse.jetty.util.log.Logger;
|
||||||
* {@link HttpSender} governs two state machines.
|
* {@link HttpSender} governs two state machines.
|
||||||
* <p>
|
* <p>
|
||||||
* The request state machine is updated by {@link HttpSender} as the various steps of sending a request
|
* The request state machine is updated by {@link HttpSender} as the various steps of sending a request
|
||||||
* are executed, see {@link RequestState}.
|
* are executed, see <code>RequestState</code>.
|
||||||
* At any point in time, a user thread may abort the request, which may (if the request has not been
|
* At any point in time, a user thread may abort the request, which may (if the request has not been
|
||||||
* completely sent yet) move the request state machine to {@link RequestState#FAILURE}.
|
* completely sent yet) move the request state machine to <code>RequestState#FAILURE</code>.
|
||||||
* The request state machine guarantees that the request steps are executed (by I/O threads) only if
|
* The request state machine guarantees that the request steps are executed (by I/O threads) only if
|
||||||
* the request has not been failed already.
|
* the request has not been failed already.
|
||||||
* <p>
|
* <p>
|
||||||
|
|
|
@ -49,7 +49,7 @@ public interface Authentication
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Executes the authentication mechanism for the given request, returning a {@link Result} that can be
|
* Executes the authentication mechanism for the given request, returning a {@link Result} that can be
|
||||||
* used to actually authenticate the request via {@link Result#apply(Request)}.
|
* used to actually authenticate the request via {@link org.eclipse.jetty.client.api.Authentication.Result#apply(Request)}.
|
||||||
* <p>
|
* <p>
|
||||||
* If a request for {@code "/secure"} returns a {@link Result}, then the result may be used for other
|
* If a request for {@code "/secure"} returns a {@link Result}, then the result may be used for other
|
||||||
* requests such as {@code "/secure/foo"} or {@code "/secure/bar"}, unless those resources are protected
|
* requests such as {@code "/secure/foo"} or {@code "/secure/bar"}, unless those resources are protected
|
||||||
|
@ -117,7 +117,7 @@ public interface Authentication
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@link Result} holds the information needed to authenticate a {@link Request} via {@link #apply(Request)}.
|
* {@link Result} holds the information needed to authenticate a {@link Request} via {@link org.eclipse.jetty.client.api.Authentication.Result#apply(org.eclipse.jetty.client.api.Request)}.
|
||||||
*/
|
*/
|
||||||
public static interface Result
|
public static interface Result
|
||||||
{
|
{
|
||||||
|
|
|
@ -30,7 +30,7 @@ import org.eclipse.jetty.client.util.PathContentProvider;
|
||||||
* <p>
|
* <p>
|
||||||
* Implementations should return an {@link Iterator} over the request content.
|
* Implementations should return an {@link Iterator} over the request content.
|
||||||
* If the request content comes from a source that needs to be closed (for
|
* If the request content comes from a source that needs to be closed (for
|
||||||
* example, an {@link InputStream}), then the iterator implementation class
|
* example, an {@link java.io.InputStream}), then the iterator implementation class
|
||||||
* must implement {@link Closeable} and will be closed when the request is
|
* must implement {@link Closeable} and will be closed when the request is
|
||||||
* completed (either successfully or failed).
|
* completed (either successfully or failed).
|
||||||
* <p>
|
* <p>
|
||||||
|
|
|
@ -205,6 +205,7 @@ public interface Request
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param content the content provider of this request
|
* @param content the content provider of this request
|
||||||
|
* @param contentType the content type
|
||||||
* @return this request object
|
* @return this request object
|
||||||
*/
|
*/
|
||||||
Request content(ContentProvider content, String contentType);
|
Request content(ContentProvider content, String contentType);
|
||||||
|
@ -285,6 +286,7 @@ public interface Request
|
||||||
/**
|
/**
|
||||||
* @param listenerClass the class of the listener, or null for all listeners classes
|
* @param listenerClass the class of the listener, or null for all listeners classes
|
||||||
* @return the listeners for request events of the given class
|
* @return the listeners for request events of the given class
|
||||||
|
* @param <T> the type of listener class
|
||||||
*/
|
*/
|
||||||
<T extends RequestListener> List<T> getRequestListeners(Class<T> listenerClass);
|
<T extends RequestListener> List<T> getRequestListeners(Class<T> listenerClass);
|
||||||
|
|
||||||
|
@ -397,6 +399,9 @@ public interface Request
|
||||||
* The method returns when the {@link Response.CompleteListener complete event} is fired.
|
* The method returns when the {@link Response.CompleteListener complete event} is fired.
|
||||||
*
|
*
|
||||||
* @return a {@link ContentResponse} for this request
|
* @return a {@link ContentResponse} for this request
|
||||||
|
* @throws InterruptedException if send thread is interrupted
|
||||||
|
* @throws TimeoutException if send times out
|
||||||
|
* @throws ExecutionException if execution fails
|
||||||
* @see Response.CompleteListener#onComplete(Result)
|
* @see Response.CompleteListener#onComplete(Result)
|
||||||
*/
|
*/
|
||||||
ContentResponse send() throws InterruptedException, TimeoutException, ExecutionException;
|
ContentResponse send() throws InterruptedException, TimeoutException, ExecutionException;
|
||||||
|
@ -498,6 +503,7 @@ public interface Request
|
||||||
* Callback method invoked when a chunk of request content has been sent successfully.
|
* Callback method invoked when a chunk of request content has been sent successfully.
|
||||||
* Changes to bytes in the given buffer have no effect, as the content has already been sent.
|
* Changes to bytes in the given buffer have no effect, as the content has already been sent.
|
||||||
* @param request the request that has been committed
|
* @param request the request that has been committed
|
||||||
|
* @param content the content
|
||||||
*/
|
*/
|
||||||
public void onContent(Request request, ByteBuffer content);
|
public void onContent(Request request, ByteBuffer content);
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,9 @@ public interface Response
|
||||||
Request getRequest();
|
Request getRequest();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the response listener passed to {@link Request#send(CompleteListener)}
|
* @param listenerClass the listener class
|
||||||
|
* @return the response listener passed to {@link org.eclipse.jetty.client.api.Request#send(org.eclipse.jetty.client.api.Response.CompleteListener)}
|
||||||
|
* @param <T> the type of class
|
||||||
*/
|
*/
|
||||||
<T extends ResponseListener> List<T> getListeners(Class<T> listenerClass);
|
<T extends ResponseListener> List<T> getListeners(Class<T> listenerClass);
|
||||||
|
|
||||||
|
|
|
@ -21,31 +21,33 @@
|
||||||
*
|
*
|
||||||
* This package provides APIs, utility classes and an implementation of an asynchronous HTTP client.
|
* This package provides APIs, utility classes and an implementation of an asynchronous HTTP client.
|
||||||
* <p>
|
* <p>
|
||||||
* The core class is {@link org.eclipse.jetty.client.api.HttpClient}, which acts as a central configuration object (for example
|
* The core class is {@link org.eclipse.jetty.client.HttpClient}, which acts as a central configuration object (for example
|
||||||
* for {@link org.eclipse.jetty.client.api.HttpClient#setIdleTimeout(long) idle timeouts}, {@link org.eclipse.jetty.client.api.HttpClient#setMaxConnectionsPerDestination(int)
|
* for {@link org.eclipse.jetty.client.HttpClient#setIdleTimeout(long) idle timeouts}, {@link org.eclipse.jetty.client.HttpClient#setMaxConnectionsPerDestination(int)
|
||||||
* max connections per destination}, etc.) and as a factory for {@link Request} objects.
|
* max connections per destination}, etc.) and as a factory for {@link org.eclipse.jetty.client.api.Request} objects.
|
||||||
* <p>
|
* <p>
|
||||||
* The HTTP protocol is based on the request/response paradigm, a unit that in this implementation is called
|
* The HTTP protocol is based on the request/response paradigm, a unit that in this implementation is called
|
||||||
* <em>exchange</em> and is represented by {@link org.eclipse.jetty.client.api.HttpExchange}.
|
* <em>exchange</em> and is represented by {@link org.eclipse.jetty.client.HttpExchange}.
|
||||||
* An initial request may trigger a sequence of exchanges with one or more servers, called a <em>conversation</em>
|
* An initial request may trigger a sequence of exchanges with one or more servers, called a <em>conversation</em>
|
||||||
* and represented by {@link org.eclipse.jetty.client.api.HttpConversation}. A typical example of a conversation is a redirect, where
|
* and represented by {@link org.eclipse.jetty.client.HttpConversation}. A typical example of a conversation is a redirect, where
|
||||||
* upon a request for a resource URI, the server replies with a redirect (for example with the 303 status code)
|
* upon a request for a resource URI, the server replies with a redirect (for example with the 303 status code)
|
||||||
* to another URI. This conversation is made of a first exchange made of the original request and its 303 response,
|
* to another URI. This conversation is made of a first exchange made of the original request and its 303 response,
|
||||||
* and of a second exchange made of the request for the new URI and its 200 response.
|
* and of a second exchange made of the request for the new URI and its 200 response.
|
||||||
* <p>
|
* <p>
|
||||||
* {@link org.eclipse.jetty.client.api.HttpClient} holds a number of {@link org.eclipse.jetty.client.api.HttpDestination destinations}, which in turn hold a number of
|
* {@link org.eclipse.jetty.client.HttpClient} holds a number of {@link org.eclipse.jetty.client.api.Destination destinations}, which in turn hold a number of
|
||||||
* pooled {@link org.eclipse.jetty.client.api.HttpConnection connections}.
|
* pooled {@link org.eclipse.jetty.client.api.Connection connections}.
|
||||||
* <p>
|
* <p>
|
||||||
* When a request is sent, its exchange is associated to a connection, either taken from an idle queue or created
|
* When a request is sent, its exchange is associated to a connection, either taken from an idle queue or created
|
||||||
* anew, and when both the request and response are completed, the exchange is disassociated from the connection.
|
* anew, and when both the request and response are completed, the exchange is disassociated from the connection.
|
||||||
* Conversations may span multiple connections on different destinations, and therefore are maintained at the
|
* Conversations may span multiple connections on different destinations, and therefore are maintained at the
|
||||||
* {@link org.eclipse.jetty.client.api.HttpClient} level.
|
* {@link org.eclipse.jetty.client.HttpClient} level.
|
||||||
* <p>
|
* <p>
|
||||||
* Applications may decide to send the request and wait for the response in a blocking way, using
|
* Applications may decide to send the request and wait for the response in a blocking way, using
|
||||||
* {@link org.eclipse.jetty.client.api.Request#send()}.
|
* {@link org.eclipse.jetty.client.api.Request#send()}.
|
||||||
* Alternatively, application may ask to be notified of response events asynchronously, using
|
* Alternatively, application may ask to be notified of response events asynchronously, using
|
||||||
* {@link org.eclipse.jetty.client.api.Request#send(Response.Listener)}.
|
* {@link org.eclipse.jetty.client.api.Request#send(org.eclipse.jetty.client.api.Response.CompleteListener)}.
|
||||||
*/
|
*/
|
||||||
package org.eclipse.jetty.client;
|
package org.eclipse.jetty.client;
|
||||||
|
|
||||||
|
import org.eclipse.jetty.client.api.Response;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -73,7 +73,7 @@ import org.eclipse.jetty.util.Callback;
|
||||||
* .content(content)
|
* .content(content)
|
||||||
* .send(new Response.CompleteListener()
|
* .send(new Response.CompleteListener()
|
||||||
* {
|
* {
|
||||||
* @Override
|
* @Override
|
||||||
* public void onComplete(Result result)
|
* public void onComplete(Result result)
|
||||||
* {
|
* {
|
||||||
* // Your logic here
|
* // Your logic here
|
||||||
|
|
|
@ -61,7 +61,7 @@ import org.eclipse.jetty.util.Callback;
|
||||||
* .content(content)
|
* .content(content)
|
||||||
* .send(new Response.CompleteListener()
|
* .send(new Response.CompleteListener()
|
||||||
* {
|
* {
|
||||||
* @Override
|
* @Override
|
||||||
* public void onComplete(Result result)
|
* public void onComplete(Result result)
|
||||||
* {
|
* {
|
||||||
* // Your logic here
|
* // Your logic here
|
||||||
|
|
|
@ -95,7 +95,7 @@ public class HostnameVerificationTest
|
||||||
* http://www.ietf.org/rfc/rfc2818.txt section 3.1. It uses a certificate with a common name different to localhost
|
* http://www.ietf.org/rfc/rfc2818.txt section 3.1. It uses a certificate with a common name different to localhost
|
||||||
* and sends a request to localhost. This should fail with a SSLHandshakeException.
|
* and sends a request to localhost. This should fail with a SSLHandshakeException.
|
||||||
*
|
*
|
||||||
* @throws Exception
|
* @throws Exception on test failure
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void simpleGetWithHostnameVerificationEnabledTest() throws Exception
|
public void simpleGetWithHostnameVerificationEnabledTest() throws Exception
|
||||||
|
@ -133,7 +133,8 @@ public class HostnameVerificationTest
|
||||||
* This test has hostname verification disabled and connecting, ssl handshake and sending the request should just
|
* This test has hostname verification disabled and connecting, ssl handshake and sending the request should just
|
||||||
* work fine.
|
* work fine.
|
||||||
*
|
*
|
||||||
* @throws Exception
|
* @throws Exception on test failure
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void simpleGetWithHostnameVerificationDisabledTest() throws Exception
|
public void simpleGetWithHostnameVerificationDisabledTest() throws Exception
|
||||||
|
@ -154,7 +155,7 @@ public class HostnameVerificationTest
|
||||||
* This test has hostname verification disabled by setting trustAll to true and connecting,
|
* This test has hostname verification disabled by setting trustAll to true and connecting,
|
||||||
* ssl handshake and sending the request should just work fine.
|
* ssl handshake and sending the request should just work fine.
|
||||||
*
|
*
|
||||||
* @throws Exception
|
* @throws Exception on test failure
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void trustAllDisablesHostnameVerificationTest() throws Exception
|
public void trustAllDisablesHostnameVerificationTest() throws Exception
|
||||||
|
|
|
@ -24,10 +24,9 @@ import javax.servlet.ServletRequest;
|
||||||
import javax.servlet.ServletResponse;
|
import javax.servlet.ServletResponse;
|
||||||
import javax.servlet.ServletResponseWrapper;
|
import javax.servlet.ServletResponseWrapper;
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
|
||||||
/**
|
/**
|
||||||
* Continuation.
|
* Continuation.
|
||||||
*
|
* <p>
|
||||||
* A continuation is a mechanism by which a HTTP Request can be suspended and
|
* A continuation is a mechanism by which a HTTP Request can be suspended and
|
||||||
* restarted after a timeout or an asynchronous event has occurred.
|
* restarted after a timeout or an asynchronous event has occurred.
|
||||||
* <p>
|
* <p>
|
||||||
|
@ -52,7 +51,7 @@ import javax.servlet.ServletResponseWrapper;
|
||||||
* <p>
|
* <p>
|
||||||
* There are two distinct style of operation of the continuation API.
|
* There are two distinct style of operation of the continuation API.
|
||||||
* </p>
|
* </p>
|
||||||
* <h3>Suspend/Resume Usage</h3>
|
* <h1>Suspend/Resume Usage</h1>
|
||||||
* <p>The suspend/resume style is used when a servlet and/or
|
* <p>The suspend/resume style is used when a servlet and/or
|
||||||
* filter is used to generate the response after a asynchronous wait that is
|
* filter is used to generate the response after a asynchronous wait that is
|
||||||
* terminated by an asynchronous handler.
|
* terminated by an asynchronous handler.
|
||||||
|
@ -87,7 +86,7 @@ import javax.servlet.ServletResponseWrapper;
|
||||||
* response.getOutputStream().write(process(results));
|
* response.getOutputStream().write(process(results));
|
||||||
* }
|
* }
|
||||||
* </pre>
|
* </pre>
|
||||||
* <h3>Suspend/Complete Usage</h3>
|
* <h1>Suspend/Complete Usage</h1>
|
||||||
* <p>
|
* <p>
|
||||||
* The suspend/complete style is used when an asynchronous handler is used to
|
* The suspend/complete style is used when an asynchronous handler is used to
|
||||||
* generate the response:
|
* generate the response:
|
||||||
|
@ -152,7 +151,7 @@ public interface Continuation
|
||||||
* @param timeoutMs
|
* @param timeoutMs
|
||||||
* The time in milliseconds to wait before expiring this
|
* The time in milliseconds to wait before expiring this
|
||||||
* continuation after a call to {@link #suspend()} or {@link #suspend(ServletResponse)}.
|
* continuation after a call to {@link #suspend()} or {@link #suspend(ServletResponse)}.
|
||||||
* A timeout of <=0 means the continuation will never expire.
|
* A timeout of <=0 means the continuation will never expire.
|
||||||
*/
|
*/
|
||||||
void setTimeout(long timeoutMs);
|
void setTimeout(long timeoutMs);
|
||||||
|
|
||||||
|
@ -164,8 +163,8 @@ public interface Continuation
|
||||||
* <p>
|
* <p>
|
||||||
* After this method has been called, the lifecycle of the request will be
|
* After this method has been called, the lifecycle of the request will be
|
||||||
* extended beyond the return to the container from the
|
* extended beyond the return to the container from the
|
||||||
* {@link Servlet#service(ServletRequest, ServletResponse)} method and
|
* {@link javax.servlet.Servlet#service(ServletRequest, ServletResponse)} method and
|
||||||
* {@link Filter#doFilter(ServletRequest, ServletResponse, FilterChain)}
|
* {@link javax.servlet.Filter#doFilter(ServletRequest, ServletResponse, FilterChain)}
|
||||||
* calls. When a suspended request is returned to the container after
|
* calls. When a suspended request is returned to the container after
|
||||||
* a dispatch, then the container will not commit the associated response
|
* a dispatch, then the container will not commit the associated response
|
||||||
* (unless an exception other than {@link ContinuationThrowable} is thrown).
|
* (unless an exception other than {@link ContinuationThrowable} is thrown).
|
||||||
|
@ -200,8 +199,8 @@ public interface Continuation
|
||||||
* <p>
|
* <p>
|
||||||
* After this method has been called, the lifecycle of the request will be
|
* After this method has been called, the lifecycle of the request will be
|
||||||
* extended beyond the return to the container from the
|
* extended beyond the return to the container from the
|
||||||
* {@link Servlet#service(ServletRequest, ServletResponse)} method and
|
* {@link javax.servlet.Servlet#service(ServletRequest, ServletResponse)} method and
|
||||||
* {@link Filter#doFilter(ServletRequest, ServletResponse, FilterChain)}
|
* {@link javax.servlet.Filter#doFilter(ServletRequest, ServletResponse, FilterChain)}
|
||||||
* calls. When a suspended request is returned to the container after
|
* calls. When a suspended request is returned to the container after
|
||||||
* a dispatch, then the container will not commit the associated response
|
* a dispatch, then the container will not commit the associated response
|
||||||
* (unless an exception other than {@link ContinuationThrowable} is thrown).
|
* (unless an exception other than {@link ContinuationThrowable} is thrown).
|
||||||
|
@ -365,7 +364,7 @@ public interface Continuation
|
||||||
/**
|
/**
|
||||||
* Add a ContinuationListener.
|
* Add a ContinuationListener.
|
||||||
*
|
*
|
||||||
* @param listener
|
* @param listener the listener
|
||||||
*/
|
*/
|
||||||
void addContinuationListener(ContinuationListener listener);
|
void addContinuationListener(ContinuationListener listener);
|
||||||
|
|
||||||
|
|
|
@ -22,13 +22,11 @@ import java.util.EventListener;
|
||||||
|
|
||||||
import javax.servlet.ServletRequestListener;
|
import javax.servlet.ServletRequestListener;
|
||||||
|
|
||||||
|
/**
|
||||||
/* ------------------------------------------------------------ */
|
* A Continuation Listener
|
||||||
/** A Continuation Listener
|
|
||||||
* <p>
|
* <p>
|
||||||
* A ContinuationListener may be registered with a call to
|
* A ContinuationListener may be registered with a call to
|
||||||
* {@link Continuation#addContinuationListener(ContinuationListener)}.
|
* {@link Continuation#addContinuationListener(ContinuationListener)}.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public interface ContinuationListener extends EventListener
|
public interface ContinuationListener extends EventListener
|
||||||
{
|
{
|
||||||
|
@ -38,7 +36,7 @@ public interface ContinuationListener extends EventListener
|
||||||
* any calls to {@link ServletRequestListener#requestDestroyed(javax.servlet.ServletRequestEvent)}
|
* any calls to {@link ServletRequestListener#requestDestroyed(javax.servlet.ServletRequestEvent)}
|
||||||
* The response may still be written to during the call.
|
* The response may still be written to during the call.
|
||||||
*
|
*
|
||||||
* @param continuation
|
* @param continuation the continuation
|
||||||
*/
|
*/
|
||||||
public void onComplete(Continuation continuation);
|
public void onComplete(Continuation continuation);
|
||||||
|
|
||||||
|
@ -48,7 +46,7 @@ public interface ContinuationListener extends EventListener
|
||||||
* The response may be written to and the methods
|
* The response may be written to and the methods
|
||||||
* {@link Continuation#resume()} or {@link Continuation#complete()}
|
* {@link Continuation#resume()} or {@link Continuation#complete()}
|
||||||
* may be called by a onTimeout implementation,
|
* may be called by a onTimeout implementation,
|
||||||
* @param continuation
|
* @param continuation the continuation
|
||||||
*/
|
*/
|
||||||
public void onTimeout(Continuation continuation);
|
public void onTimeout(Continuation continuation);
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,7 @@ public class ConnectorServer extends AbstractLifeCycle
|
||||||
* The actual address of the new connector server, as returned
|
* The actual address of the new connector server, as returned
|
||||||
* by its getAddress method, will not necessarily be exactly the same.
|
* by its getAddress method, will not necessarily be exactly the same.
|
||||||
* @param name object name string to be assigned to connector server bean
|
* @param name object name string to be assigned to connector server bean
|
||||||
* @throws Exception
|
* @throws Exception if unable to setup connector server
|
||||||
*/
|
*/
|
||||||
public ConnectorServer(JMXServiceURL serviceURL, String name)
|
public ConnectorServer(JMXServiceURL serviceURL, String name)
|
||||||
throws Exception
|
throws Exception
|
||||||
|
@ -77,7 +77,7 @@ public class ConnectorServer extends AbstractLifeCycle
|
||||||
* be Strings. The appropriate type of each associated value depends on
|
* be Strings. The appropriate type of each associated value depends on
|
||||||
* the attribute. The contents of environment are not changed by this call.
|
* the attribute. The contents of environment are not changed by this call.
|
||||||
* @param name object name string to be assigned to connector server bean
|
* @param name object name string to be assigned to connector server bean
|
||||||
* @throws Exception
|
* @throws Exception if unable to create connector server
|
||||||
*/
|
*/
|
||||||
public ConnectorServer(JMXServiceURL svcUrl, Map<String,?> environment, String name)
|
public ConnectorServer(JMXServiceURL svcUrl, Map<String,?> environment, String name)
|
||||||
throws Exception
|
throws Exception
|
||||||
|
|
|
@ -59,18 +59,18 @@ import org.eclipse.jetty.util.annotation.Name;
|
||||||
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;
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
/**
|
||||||
/** ObjectMBean.
|
* ObjectMBean.
|
||||||
|
* <p>
|
||||||
* A dynamic MBean that can wrap an arbitary Object instance.
|
* A dynamic MBean that can wrap an arbitary Object instance.
|
||||||
* the attributes and methods exposed by this bean are controlled by
|
* the attributes and methods exposed by this bean are controlled by
|
||||||
* the merge of property bundles discovered by names related to all
|
* the merge of property bundles discovered by names related to all
|
||||||
* superclasses and all superinterfaces.
|
* superclasses and all superinterfaces.
|
||||||
*
|
* <p>
|
||||||
* Attributes and methods exported may be "Object" and must exist on the
|
* Attributes and methods exported may be "Object" and must exist on the
|
||||||
* wrapped object, or "MBean" and must exist on a subclass of OBjectMBean
|
* wrapped object, or "MBean" and must exist on a subclass of OBjectMBean
|
||||||
* or "MObject" which exists on the wrapped object, but whose values are
|
* or "MObject" which exists on the wrapped object, but whose values are
|
||||||
* converted to MBean object names.
|
* converted to MBean object names.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class ObjectMBean implements DynamicMBean
|
public class ObjectMBean implements DynamicMBean
|
||||||
{
|
{
|
||||||
|
@ -592,7 +592,7 @@ public class ObjectMBean implements DynamicMBean
|
||||||
* getter and setter methods. Descriptions are obtained with a call to findDescription with the
|
* getter and setter methods. Descriptions are obtained with a call to findDescription with the
|
||||||
* attribute name.
|
* attribute name.
|
||||||
*
|
*
|
||||||
* @param method
|
* @param method the method to define
|
||||||
* @param attributeAnnotation "description" or "access:description" or "type:access:description" where type is
|
* @param attributeAnnotation "description" or "access:description" or "type:access:description" where type is
|
||||||
* one of: <ul>
|
* one of: <ul>
|
||||||
* <li>"Object" The field/method is on the managed object.
|
* <li>"Object" The field/method is on the managed object.
|
||||||
|
@ -601,6 +601,7 @@ public class ObjectMBean implements DynamicMBean
|
||||||
* <li>"MMBean" The field/method is on the mbean proxy object and value should be converted to MBean reference
|
* <li>"MMBean" The field/method is on the mbean proxy object and value should be converted to MBean reference
|
||||||
* </ul>
|
* </ul>
|
||||||
* the access is either "RW" or "RO".
|
* the access is either "RW" or "RO".
|
||||||
|
* @return the mbean attribute info for the method
|
||||||
*/
|
*/
|
||||||
public MBeanAttributeInfo defineAttribute(Method method, ManagedAttribute attributeAnnotation)
|
public MBeanAttributeInfo defineAttribute(Method method, ManagedAttribute attributeAnnotation)
|
||||||
{
|
{
|
||||||
|
|
|
@ -44,11 +44,9 @@ 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;
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
/**
|
/**
|
||||||
* CGI Servlet.
|
* CGI Servlet.
|
||||||
* <p>
|
* <p>
|
||||||
*
|
|
||||||
* The following init parameters are used to configure this servlet:
|
* The following init parameters are used to configure this servlet:
|
||||||
* <dl>
|
* <dl>
|
||||||
* <dt>cgibinResourceBase</dt>
|
* <dt>cgibinResourceBase</dt>
|
||||||
|
@ -69,7 +67,6 @@ import org.eclipse.jetty.util.log.Logger;
|
||||||
* <dt>ignoreExitState</dt>
|
* <dt>ignoreExitState</dt>
|
||||||
* <dd>If true then do not act on a non-zero exec exit status")</dd>
|
* <dd>If true then do not act on a non-zero exec exit status")</dd>
|
||||||
* </dl>
|
* </dl>
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class CGI extends HttpServlet
|
public class CGI extends HttpServlet
|
||||||
{
|
{
|
||||||
|
@ -546,13 +543,18 @@ public class CGI extends HttpServlet
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set a name/value pair, null values will be treated as an empty String
|
* Set a name/value pair, null values will be treated as an empty String
|
||||||
|
* @param name the name
|
||||||
|
* @param value the value
|
||||||
*/
|
*/
|
||||||
public void set(String name, String value)
|
public void set(String name, String value)
|
||||||
{
|
{
|
||||||
envMap.put(name,name + "=" + StringUtil.nonNull(value));
|
envMap.put(name,name + "=" + StringUtil.nonNull(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Get representation suitable for passing to exec. */
|
/**
|
||||||
|
* Get representation suitable for passing to exec.
|
||||||
|
* @return the env map as an array
|
||||||
|
*/
|
||||||
public String[] getEnvArray()
|
public String[] getEnvArray()
|
||||||
{
|
{
|
||||||
return envMap.values().toArray(new String[envMap.size()]);
|
return envMap.values().toArray(new String[envMap.size()]);
|
||||||
|
|
|
@ -27,8 +27,9 @@ import javax.servlet.http.HttpServlet;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
/**
|
||||||
/** Concatenation Servlet
|
* Concatenation Servlet
|
||||||
|
* <p>
|
||||||
* This servlet may be used to concatenate multiple resources into
|
* This servlet may be used to concatenate multiple resources into
|
||||||
* a single response. It is intended to be used to load multiple
|
* a single response. It is intended to be used to load multiple
|
||||||
* javascript or css files, but may be used for any content of the
|
* javascript or css files, but may be used for any content of the
|
||||||
|
@ -42,11 +43,11 @@ import javax.servlet.http.HttpServletResponse;
|
||||||
* relative to the context root. So these script tags:
|
* relative to the context root. So these script tags:
|
||||||
* <pre>
|
* <pre>
|
||||||
* <script type="text/javascript" src="../js/behaviour.js"></script>
|
* <script type="text/javascript" src="../js/behaviour.js"></script>
|
||||||
* <script type="text/javascript" src="../js/ajax.js&/chat/chat.js"></script>
|
* <script type="text/javascript" src="../js/ajax.js&/chat/chat.js"></script>
|
||||||
* <script type="text/javascript" src="../chat/chat.js"></script>
|
* <script type="text/javascript" src="../chat/chat.js"></script>
|
||||||
* </pre> can be replaced with the single tag (with the ConcatServlet mapped to /concat):
|
* </pre> can be replaced with the single tag (with the ConcatServlet mapped to /concat):
|
||||||
* <pre>
|
* <pre>
|
||||||
* <script type="text/javascript" src="../concat?/js/behaviour.js&/js/ajax.js&/chat/chat.js"></script>
|
* <script type="text/javascript" src="../concat?/js/behaviour.js&/js/ajax.js&/chat/chat.js"></script>
|
||||||
* </pre>
|
* </pre>
|
||||||
* The {@link ServletContext#getMimeType(String)} method is used to determine the
|
* The {@link ServletContext#getMimeType(String)} method is used to determine the
|
||||||
* mime type of each resource. If the types of all resources do not match, then a 415
|
* mime type of each resource. If the types of all resources do not match, then a 415
|
||||||
|
|
|
@ -40,44 +40,62 @@ import org.eclipse.jetty.util.log.Log;
|
||||||
import org.eclipse.jetty.util.log.Logger;
|
import org.eclipse.jetty.util.log.Logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>Implementation of the
|
* Implementation of the
|
||||||
* <a href="http://www.w3.org/TR/cors/">cross-origin resource sharing</a>.</p>
|
* <a href="http://www.w3.org/TR/cors/">cross-origin resource sharing</a>.
|
||||||
* <p>A typical example is to use this filter to allow cross-domain
|
* <p>
|
||||||
|
* A typical example is to use this filter to allow cross-domain
|
||||||
* <a href="http://cometd.org">cometd</a> communication using the standard
|
* <a href="http://cometd.org">cometd</a> communication using the standard
|
||||||
* long polling transport instead of the JSONP transport (that is less
|
* long polling transport instead of the JSONP transport (that is less
|
||||||
* efficient and less reactive to failures).</p>
|
* efficient and less reactive to failures).
|
||||||
* <p>This filter allows the following configuration parameters:
|
* <p>
|
||||||
* <ul>
|
* This filter allows the following configuration parameters:
|
||||||
* <li><b>allowedOrigins</b>, a comma separated list of origins that are
|
* <dl>
|
||||||
|
* <dt>allowedOrigins</dt>
|
||||||
|
* <dd>a comma separated list of origins that are
|
||||||
* allowed to access the resources. Default value is <b>*</b>, meaning all
|
* allowed to access the resources. Default value is <b>*</b>, meaning all
|
||||||
* origins.<br>
|
* origins.
|
||||||
|
* <p>
|
||||||
* If an allowed origin contains one or more * characters (for example
|
* If an allowed origin contains one or more * characters (for example
|
||||||
* http://*.domain.com), then "*" characters are converted to ".*", "."
|
* http://*.domain.com), then "*" characters are converted to ".*", "."
|
||||||
* characters are escaped to "\." and the resulting allowed origin
|
* characters are escaped to "\." and the resulting allowed origin
|
||||||
* interpreted as a regular expression.<br>
|
* interpreted as a regular expression.
|
||||||
|
* <p>
|
||||||
* Allowed origins can therefore be more complex expressions such as
|
* Allowed origins can therefore be more complex expressions such as
|
||||||
* https?://*.domain.[a-z]{3} that matches http or https, multiple subdomains
|
* https?://*.domain.[a-z]{3} that matches http or https, multiple subdomains
|
||||||
* and any 3 letter top-level domain (.com, .net, .org, etc.).</li>
|
* and any 3 letter top-level domain (.com, .net, .org, etc.).</dd>
|
||||||
* <li><b>allowedMethods</b>, a comma separated list of HTTP methods that
|
*
|
||||||
|
* <dt>allowedMethods</dt>
|
||||||
|
* <dd>a comma separated list of HTTP methods that
|
||||||
* are allowed to be used when accessing the resources. Default value is
|
* are allowed to be used when accessing the resources. Default value is
|
||||||
* <b>GET,POST,HEAD</b></li>
|
* <b>GET,POST,HEAD</b></dd>
|
||||||
* <li><b>allowedHeaders</b>, a comma separated list of HTTP headers that
|
*
|
||||||
|
* <dt>allowedHeaders</dt>
|
||||||
|
* <dd>a comma separated list of HTTP headers that
|
||||||
* are allowed to be specified when accessing the resources. Default value
|
* are allowed to be specified when accessing the resources. Default value
|
||||||
* is <b>X-Requested-With,Content-Type,Accept,Origin</b>. If the value is a single "*",
|
* is <b>X-Requested-With,Content-Type,Accept,Origin</b>. If the value is a single "*",
|
||||||
* this means that any headers will be accepted.</li>
|
* this means that any headers will be accepted.</dd>
|
||||||
* <li><b>preflightMaxAge</b>, the number of seconds that preflight requests
|
*
|
||||||
|
* <dt>preflightMaxAge</dt>
|
||||||
|
* <dd>the number of seconds that preflight requests
|
||||||
* can be cached by the client. Default value is <b>1800</b> seconds, or 30
|
* can be cached by the client. Default value is <b>1800</b> seconds, or 30
|
||||||
* minutes</li>
|
* minutes</dd>
|
||||||
* <li><b>allowCredentials</b>, a boolean indicating if the resource allows
|
*
|
||||||
* requests with credentials. Default value is <b>true</b></li>
|
* <dt>allowCredentials</dt>
|
||||||
* <li><b>exposedHeaders</b>, a comma separated list of HTTP headers that
|
* <dd>a boolean indicating if the resource allows
|
||||||
|
* requests with credentials. Default value is <b>true</b></dd>
|
||||||
|
*
|
||||||
|
* <dt>exposedHeaders</dt>
|
||||||
|
* <dd>a comma separated list of HTTP headers that
|
||||||
* are allowed to be exposed on the client. Default value is the
|
* are allowed to be exposed on the client. Default value is the
|
||||||
* <b>empty list</b></li>
|
* <b>empty list</b></dd>
|
||||||
* <li><b>chainPreflight</b>, if true preflight requests are chained to their
|
*
|
||||||
|
* <dt>chainPreflight</dt>
|
||||||
|
* <dd>if true preflight requests are chained to their
|
||||||
* target resource for normal handling (as an OPTION request). Otherwise the
|
* target resource for normal handling (as an OPTION request). Otherwise the
|
||||||
* filter will response to the preflight. Default is <b>true</b>.</li>
|
* filter will response to the preflight. Default is <b>true</b>.</dd>
|
||||||
* </ul></p>
|
*
|
||||||
* <p>A typical configuration could be:</p>
|
* </dl>
|
||||||
|
* A typical configuration could be:
|
||||||
* <pre>
|
* <pre>
|
||||||
* <web-app ...>
|
* <web-app ...>
|
||||||
* ...
|
* ...
|
||||||
|
|
|
@ -64,7 +64,6 @@ import org.eclipse.jetty.util.thread.Scheduler;
|
||||||
/**
|
/**
|
||||||
* Denial of Service filter
|
* Denial of Service filter
|
||||||
* <p>
|
* <p>
|
||||||
* <p>
|
|
||||||
* This filter is useful for limiting
|
* This filter is useful for limiting
|
||||||
* exposure to abuse from request flooding, whether malicious, or as a result of
|
* exposure to abuse from request flooding, whether malicious, or as a result of
|
||||||
* a misconfigured client.
|
* a misconfigured client.
|
||||||
|
@ -81,13 +80,12 @@ import org.eclipse.jetty.util.thread.Scheduler;
|
||||||
* The {@link #extractUserId(ServletRequest request)} function should be
|
* The {@link #extractUserId(ServletRequest request)} function should be
|
||||||
* implemented, in order to uniquely identify authenticated users.
|
* implemented, in order to uniquely identify authenticated users.
|
||||||
* <p>
|
* <p>
|
||||||
* The following init parameters control the behavior of the filter:<dl>
|
* The following init parameters control the behavior of the filter:
|
||||||
* <p>
|
* <dl>
|
||||||
* <dt>maxRequestsPerSec</dt>
|
* <dt>maxRequestsPerSec</dt>
|
||||||
* <dd>the maximum number of requests from a connection per
|
* <dd>the maximum number of requests from a connection per
|
||||||
* second. Requests in excess of this are first delayed,
|
* second. Requests in excess of this are first delayed,
|
||||||
* then throttled.</dd>
|
* then throttled.</dd>
|
||||||
* <p>
|
|
||||||
* <dt>delayMs</dt>
|
* <dt>delayMs</dt>
|
||||||
* <dd>is the delay given to all requests over the rate limit,
|
* <dd>is the delay given to all requests over the rate limit,
|
||||||
* before they are considered at all. -1 means just reject request,
|
* before they are considered at all. -1 means just reject request,
|
||||||
|
@ -120,7 +118,6 @@ import org.eclipse.jetty.util.thread.Scheduler;
|
||||||
* <dd>The status code to send if there are too many requests. By default is 429 (too many requests), but 503 (Unavailable) is
|
* <dd>The status code to send if there are too many requests. By default is 429 (too many requests), but 503 (Unavailable) is
|
||||||
* another option</dd>
|
* another option</dd>
|
||||||
* </dl>
|
* </dl>
|
||||||
* </p>
|
|
||||||
* <p>
|
* <p>
|
||||||
* This filter should be configured for {@link DispatcherType#REQUEST} and {@link DispatcherType#ASYNC} and with
|
* This filter should be configured for {@link DispatcherType#REQUEST} and {@link DispatcherType#ASYNC} and with
|
||||||
* <code><async-supported>true</async-supported></code>.
|
* <code><async-supported>true</async-supported></code>.
|
||||||
|
@ -787,6 +784,7 @@ public class DoSFilter implements Filter
|
||||||
/**
|
/**
|
||||||
* Get delay (in milliseconds) that is applied to all requests
|
* Get delay (in milliseconds) that is applied to all requests
|
||||||
* over the rate limit, before they are considered at all.
|
* over the rate limit, before they are considered at all.
|
||||||
|
* @return the delay in milliseconds
|
||||||
*/
|
*/
|
||||||
@ManagedAttribute("delay applied to all requests over the rate limit (in ms)")
|
@ManagedAttribute("delay applied to all requests over the rate limit (in ms)")
|
||||||
public long getDelayMs()
|
public long getDelayMs()
|
||||||
|
@ -1112,6 +1110,7 @@ public class DoSFilter implements Filter
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @param now the time now (in milliseconds)
|
||||||
* @return the current calculated request rate over the last second
|
* @return the current calculated request rate over the last second
|
||||||
*/
|
*/
|
||||||
public boolean isRateExceeded(long now)
|
public boolean isRateExceeded(long now)
|
||||||
|
|
|
@ -56,7 +56,6 @@ import org.eclipse.jetty.util.log.Log;
|
||||||
import org.eclipse.jetty.util.log.Logger;
|
import org.eclipse.jetty.util.log.Logger;
|
||||||
|
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
|
||||||
/**
|
/**
|
||||||
* Multipart Form Data Filter.
|
* Multipart Form Data Filter.
|
||||||
* <p>
|
* <p>
|
||||||
|
@ -95,6 +94,7 @@ import org.eclipse.jetty.util.log.Logger;
|
||||||
* </dl>
|
* </dl>
|
||||||
* @deprecated See servlet 3.0 apis like javax.servlet.http.HttpServletRequest.getParts()
|
* @deprecated See servlet 3.0 apis like javax.servlet.http.HttpServletRequest.getParts()
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public class MultiPartFilter implements Filter
|
public class MultiPartFilter implements Filter
|
||||||
{
|
{
|
||||||
private static final Logger LOG = Log.getLogger(MultiPartFilter.class);
|
private static final Logger LOG = Log.getLogger(MultiPartFilter.class);
|
||||||
|
@ -243,9 +243,6 @@ public class MultiPartFilter implements Filter
|
||||||
MultiMap<Object> _params;
|
MultiMap<Object> _params;
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------------- */
|
/* ------------------------------------------------------------------------------- */
|
||||||
/** Constructor.
|
|
||||||
* @param request
|
|
||||||
*/
|
|
||||||
public Wrapper(HttpServletRequest request, MultiMap map)
|
public Wrapper(HttpServletRequest request, MultiMap map)
|
||||||
{
|
{
|
||||||
super(request);
|
super(request);
|
||||||
|
|
|
@ -133,6 +133,7 @@ public class GzipContentLengthTest
|
||||||
/**
|
/**
|
||||||
* Test with content servlet that does:
|
* Test with content servlet that does:
|
||||||
* AsyncContext create -> timeout -> onTimeout -> write-response -> complete
|
* AsyncContext create -> timeout -> onTimeout -> write-response -> complete
|
||||||
|
* @throws Exception on test failure
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testAsyncTimeoutCompleteWrite_Default() throws Exception
|
public void testAsyncTimeoutCompleteWrite_Default() throws Exception
|
||||||
|
@ -143,6 +144,7 @@ public class GzipContentLengthTest
|
||||||
/**
|
/**
|
||||||
* Test with content servlet that does:
|
* Test with content servlet that does:
|
||||||
* AsyncContext create -> timeout -> onTimeout -> write-response -> complete
|
* AsyncContext create -> timeout -> onTimeout -> write-response -> complete
|
||||||
|
* @throws Exception on test failure
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testAsyncTimeoutCompleteWrite_Passed() throws Exception
|
public void testAsyncTimeoutCompleteWrite_Passed() throws Exception
|
||||||
|
@ -153,6 +155,7 @@ public class GzipContentLengthTest
|
||||||
/**
|
/**
|
||||||
* Test with content servlet that does:
|
* Test with content servlet that does:
|
||||||
* AsyncContext create -> timeout -> onTimeout -> dispatch -> write-response
|
* AsyncContext create -> timeout -> onTimeout -> dispatch -> write-response
|
||||||
|
* @throws Exception on test failure
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testAsyncTimeoutDispatchWrite_Default() throws Exception
|
public void testAsyncTimeoutDispatchWrite_Default() throws Exception
|
||||||
|
@ -163,6 +166,7 @@ public class GzipContentLengthTest
|
||||||
/**
|
/**
|
||||||
* Test with content servlet that does:
|
* Test with content servlet that does:
|
||||||
* AsyncContext create -> timeout -> onTimeout -> dispatch -> write-response
|
* AsyncContext create -> timeout -> onTimeout -> dispatch -> write-response
|
||||||
|
* @throws Exception on test failure
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testAsyncTimeoutDispatchWrite_Passed() throws Exception
|
public void testAsyncTimeoutDispatchWrite_Passed() throws Exception
|
||||||
|
@ -173,6 +177,7 @@ public class GzipContentLengthTest
|
||||||
/**
|
/**
|
||||||
* Test with content servlet that does:
|
* Test with content servlet that does:
|
||||||
* AsyncContext create -> no-timeout -> scheduler.schedule -> dispatch -> write-response
|
* AsyncContext create -> no-timeout -> scheduler.schedule -> dispatch -> write-response
|
||||||
|
* @throws Exception on test failure
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testAsyncScheduledDispatchWrite_Default() throws Exception
|
public void testAsyncScheduledDispatchWrite_Default() throws Exception
|
||||||
|
@ -183,6 +188,7 @@ public class GzipContentLengthTest
|
||||||
/**
|
/**
|
||||||
* Test with content servlet that does:
|
* Test with content servlet that does:
|
||||||
* AsyncContext create -> no-timeout -> scheduler.schedule -> dispatch -> write-response
|
* AsyncContext create -> no-timeout -> scheduler.schedule -> dispatch -> write-response
|
||||||
|
* @throws Exception on test failure
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testAsyncScheduledDispatchWrite_Passed() throws Exception
|
public void testAsyncScheduledDispatchWrite_Passed() throws Exception
|
||||||
|
@ -197,7 +203,8 @@ public class GzipContentLengthTest
|
||||||
* 3) setHeader(content-type)
|
* 3) setHeader(content-type)
|
||||||
* 4) outputStream.write()
|
* 4) outputStream.write()
|
||||||
*
|
*
|
||||||
* @see <a href="Eclipse Bug 354014">http://bugs.eclipse.org/354014</a>
|
* @throws Exception on test failure
|
||||||
|
* @see <a href="http://bugs.eclipse.org/354014">Eclipse Bug 354014</a>
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testServletLengthStreamTypeWrite() throws Exception
|
public void testServletLengthStreamTypeWrite() throws Exception
|
||||||
|
@ -212,7 +219,8 @@ public class GzipContentLengthTest
|
||||||
* 3) getOutputStream()
|
* 3) getOutputStream()
|
||||||
* 4) outputStream.write()
|
* 4) outputStream.write()
|
||||||
*
|
*
|
||||||
* @see <a href="Eclipse Bug 354014">http://bugs.eclipse.org/354014</a>
|
* @throws Exception on test failure
|
||||||
|
* @see <a href="http://bugs.eclipse.org/354014">Eclipse Bug 354014</a>
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testServletLengthTypeStreamWrite() throws Exception
|
public void testServletLengthTypeStreamWrite() throws Exception
|
||||||
|
@ -227,7 +235,8 @@ public class GzipContentLengthTest
|
||||||
* 3) setHeader(content-type)
|
* 3) setHeader(content-type)
|
||||||
* 4) outputStream.write()
|
* 4) outputStream.write()
|
||||||
*
|
*
|
||||||
* @see <a href="Eclipse Bug 354014">http://bugs.eclipse.org/354014</a>
|
* @throws Exception on test failure
|
||||||
|
* @see <a href="http://bugs.eclipse.org/354014">Eclipse Bug 354014</a>
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testServletStreamLengthTypeWrite() throws Exception
|
public void testServletStreamLengthTypeWrite() throws Exception
|
||||||
|
@ -242,7 +251,8 @@ public class GzipContentLengthTest
|
||||||
* 3) setHeader(content-type)
|
* 3) setHeader(content-type)
|
||||||
* 4) outputStream.write() (with frequent response flush)
|
* 4) outputStream.write() (with frequent response flush)
|
||||||
*
|
*
|
||||||
* @see <a href="Eclipse Bug 354014">http://bugs.eclipse.org/354014</a>
|
* @throws Exception on test failure
|
||||||
|
* @see <a href="http://bugs.eclipse.org/354014">Eclipse Bug 354014</a>
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testServletStreamLengthTypeWriteWithFlush() throws Exception
|
public void testServletStreamLengthTypeWriteWithFlush() throws Exception
|
||||||
|
@ -257,7 +267,8 @@ public class GzipContentLengthTest
|
||||||
* 3) setHeader(content-length)
|
* 3) setHeader(content-length)
|
||||||
* 4) outputStream.write()
|
* 4) outputStream.write()
|
||||||
*
|
*
|
||||||
* @see <a href="Eclipse Bug 354014">http://bugs.eclipse.org/354014</a>
|
* @throws Exception on test failure
|
||||||
|
* @see <a href="http://bugs.eclipse.org/354014">Eclipse Bug 354014</a>
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testServletStreamTypeLengthWrite() throws Exception
|
public void testServletStreamTypeLengthWrite() throws Exception
|
||||||
|
@ -272,7 +283,8 @@ public class GzipContentLengthTest
|
||||||
* 3) getOutputStream()
|
* 3) getOutputStream()
|
||||||
* 4) outputStream.write()
|
* 4) outputStream.write()
|
||||||
*
|
*
|
||||||
* @see <a href="Eclipse Bug 354014">http://bugs.eclipse.org/354014</a>
|
* @throws Exception on test failure
|
||||||
|
* @see <a href="http://bugs.eclipse.org/354014">Eclipse Bug 354014</a>
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testServletTypeLengthStreamWrite() throws Exception
|
public void testServletTypeLengthStreamWrite() throws Exception
|
||||||
|
@ -287,6 +299,7 @@ public class GzipContentLengthTest
|
||||||
* 3) setHeader(content-length)
|
* 3) setHeader(content-length)
|
||||||
* 4) outputStream.write()
|
* 4) outputStream.write()
|
||||||
*
|
*
|
||||||
|
* @throws Exception on test failure
|
||||||
* @see <a href="Eclipse Bug 354014">http://bugs.eclipse.org/354014</a>
|
* @see <a href="Eclipse Bug 354014">http://bugs.eclipse.org/354014</a>
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
|
@ -305,7 +318,8 @@ public class GzipContentLengthTest
|
||||||
* This is done to demonstrate a bug with using HttpOutput.write()
|
* This is done to demonstrate a bug with using HttpOutput.write()
|
||||||
* while also using GzipFilter
|
* while also using GzipFilter
|
||||||
*
|
*
|
||||||
* @see <a href="Eclipse Bug 450873">http://bugs.eclipse.org/450873</a>
|
* @throws Exception on test failure
|
||||||
|
* @see <a href="http://bugs.eclipse.org/450873">Eclipse Bug 450873</a>
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testHttpOutputWrite() throws Exception
|
public void testHttpOutputWrite() throws Exception
|
||||||
|
|
|
@ -345,7 +345,8 @@ public class GzipTester
|
||||||
* the filename used to on the GET request,.
|
* the filename used to on the GET request,.
|
||||||
* @param testResourceSha1Sum
|
* @param testResourceSha1Sum
|
||||||
* the sha1sum file that contains the SHA1SUM checksum that will be used to verify that the response contents are what is intended.
|
* the sha1sum file that contains the SHA1SUM checksum that will be used to verify that the response contents are what is intended.
|
||||||
* @param expectedContentType
|
* @param expectedContentType the expected content type
|
||||||
|
* @throws Exception on test failure
|
||||||
*/
|
*/
|
||||||
public void assertIsResponseNotGziped(String requestedFilename, String testResourceSha1Sum, String expectedContentType) throws Exception
|
public void assertIsResponseNotGziped(String requestedFilename, String testResourceSha1Sum, String expectedContentType) throws Exception
|
||||||
{
|
{
|
||||||
|
@ -363,9 +364,10 @@ public class GzipTester
|
||||||
* the filename used to on the GET request,.
|
* the filename used to on the GET request,.
|
||||||
* @param testResourceSha1Sum
|
* @param testResourceSha1Sum
|
||||||
* the sha1sum file that contains the SHA1SUM checksum that will be used to verify that the response contents are what is intended.
|
* the sha1sum file that contains the SHA1SUM checksum that will be used to verify that the response contents are what is intended.
|
||||||
* @param expectedContentType
|
* @param expectedContentType the expected content type
|
||||||
* @param expectedContentEncoding
|
* @param expectedContentEncoding
|
||||||
* can be non-null in some circumstances, eg when dealing with pre-gzipped .svgz files
|
* can be non-null in some circumstances, eg when dealing with pre-gzipped .svgz files
|
||||||
|
* @throws Exception on test failure
|
||||||
*/
|
*/
|
||||||
public void assertIsResponseNotGzipFiltered(String requestedFilename, String testResourceSha1Sum, String expectedContentType, String expectedContentEncoding)
|
public void assertIsResponseNotGzipFiltered(String requestedFilename, String testResourceSha1Sum, String expectedContentType, String expectedContentEncoding)
|
||||||
throws Exception
|
throws Exception
|
||||||
|
@ -531,6 +533,8 @@ public class GzipTester
|
||||||
* the filename to create
|
* the filename to create
|
||||||
* @param filesize
|
* @param filesize
|
||||||
* the file size to create (Note: this isn't suitable for creating large multi-megabyte files)
|
* the file size to create (Note: this isn't suitable for creating large multi-megabyte files)
|
||||||
|
* @return the prepared file
|
||||||
|
* @throws IOException if unable to create file
|
||||||
*/
|
*/
|
||||||
public File prepareServerFile(String filename, int filesize) throws IOException
|
public File prepareServerFile(String filename, int filesize) throws IOException
|
||||||
{
|
{
|
||||||
|
@ -564,6 +568,7 @@ public class GzipTester
|
||||||
*
|
*
|
||||||
* @param filename
|
* @param filename
|
||||||
* the filename to look for in src/test/resources
|
* the filename to look for in src/test/resources
|
||||||
|
* @throws IOException if unable to copy file
|
||||||
*/
|
*/
|
||||||
public void copyTestServerFile(String filename) throws IOException
|
public void copyTestServerFile(String filename) throws IOException
|
||||||
{
|
{
|
||||||
|
@ -578,6 +583,7 @@ public class GzipTester
|
||||||
*
|
*
|
||||||
* @param servletClass
|
* @param servletClass
|
||||||
* the servlet that will provide content.
|
* the servlet that will provide content.
|
||||||
|
* @throws IOException if unable to set content servlet
|
||||||
*/
|
*/
|
||||||
public void setContentServlet(Class<? extends Servlet> servletClass) throws IOException
|
public void setContentServlet(Class<? extends Servlet> servletClass) throws IOException
|
||||||
{
|
{
|
||||||
|
@ -612,6 +618,7 @@ public class GzipTester
|
||||||
* the path spec for this filter
|
* the path spec for this filter
|
||||||
* @param dispatches
|
* @param dispatches
|
||||||
* the set of {@link DispatcherType} to associate with this filter
|
* the set of {@link DispatcherType} to associate with this filter
|
||||||
|
* @throws IOException if unable to add filter
|
||||||
*/
|
*/
|
||||||
public void addFilter(FilterHolder holder, String pathSpec, EnumSet<DispatcherType> dispatches) throws IOException
|
public void addFilter(FilterHolder holder, String pathSpec, EnumSet<DispatcherType> dispatches) throws IOException
|
||||||
{
|
{
|
||||||
|
|
|
@ -780,10 +780,6 @@ public class MultipartFilterTest
|
||||||
assertEquals(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, response.getStatus());
|
assertEquals(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, response.getStatus());
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* see the testParameterMap test
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public static class TestServletParameterMap extends DumpServlet
|
public static class TestServletParameterMap extends DumpServlet
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
|
@ -798,7 +794,7 @@ public class MultipartFilterTest
|
||||||
/**
|
/**
|
||||||
* Validate that the getParameterMap() call is correctly unencoding the parameters in the
|
* Validate that the getParameterMap() call is correctly unencoding the parameters in the
|
||||||
* map that it returns.
|
* map that it returns.
|
||||||
* @throws Exception
|
* @throws Exception on test failure
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testParameterMap() throws Exception
|
public void testParameterMap() throws Exception
|
||||||
|
|
Loading…
Reference in New Issue