Package org.apache.tapestry5.http
Class AsyncRequestHandlerResponse
- java.lang.Object
-
- org.apache.tapestry5.http.AsyncRequestHandlerResponse
-
public class AsyncRequestHandlerResponse extends java.lang.Object
Class used by AsyncRequestHandler to return information on how to handle a request.- See Also:
AsyncRequestHandler
-
-
Constructor Summary
Constructors Constructor Description AsyncRequestHandlerResponse(java.util.concurrent.Executor executor)
Creates an instance with a givenExecutor
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.concurrent.Executor
getExecutor()
Returns theExecutor
to be used to process the request.AsyncListener
getListener()
Returns the listener to be added to the asynchronous request or null.HttpServletRequest
getRequest()
Returns the request to be used withServletRequest.startAsync()
or null.HttpServletResponse
getResponse()
Returns the response to be used withServletRequest.startAsync()
or null.long
getTimeout()
Returns the timeout, in milliseconds, for the asynchronous request.boolean
isAsync()
Returns whether the request should be processed asynchronously or not.boolean
isHasRequestAndResponse()
Returns whether a request and a response were set in this object.static AsyncRequestHandlerResponse
notHandled()
Returns a response saying this AsyncRequestHandler doesn't handle this request.java.lang.String
toString()
AsyncRequestHandlerResponse
with(AsyncListener listener)
Defines a listener to be added to the asynchronous request.AsyncRequestHandlerResponse
with(HttpServletRequest request, HttpServletResponse response)
Defines a different request and response to be passed toServletRequest.startAsync(javax.servlet.ServletRequest, javax.servlet.ServletResponse)
.AsyncRequestHandlerResponse
withTimeout(long timeout)
Sets the timeout for this asynchronous request in milliseconds.
-
-
-
Constructor Detail
-
AsyncRequestHandlerResponse
public AsyncRequestHandlerResponse(java.util.concurrent.Executor executor)
Creates an instance with a givenExecutor
. It cannot be null. If you want an instance with a non-async response, usenotHandled()
instead.- Parameters:
executor
- a non-nullExecutor
.
-
-
Method Detail
-
with
public AsyncRequestHandlerResponse with(HttpServletRequest request, HttpServletResponse response)
Defines a different request and response to be passed toServletRequest.startAsync(javax.servlet.ServletRequest, javax.servlet.ServletResponse)
. Both cannot be null.
-
with
public AsyncRequestHandlerResponse with(AsyncListener listener)
Defines a listener to be added to the asynchronous request. It cannot be null.
-
withTimeout
public AsyncRequestHandlerResponse withTimeout(long timeout)
Sets the timeout for this asynchronous request in milliseconds.
-
notHandled
public static AsyncRequestHandlerResponse notHandled()
Returns a response saying this AsyncRequestHandler doesn't handle this request.- Returns:
- an
AsyncRequestHandlerResponse
.
-
isAsync
public boolean isAsync()
Returns whether the request should be processed asynchronously or not.
-
getExecutor
public java.util.concurrent.Executor getExecutor()
Returns theExecutor
to be used to process the request.
-
getRequest
public HttpServletRequest getRequest()
Returns the request to be used withServletRequest.startAsync()
or null.
-
getResponse
public HttpServletResponse getResponse()
Returns the response to be used withServletRequest.startAsync()
or null.
-
getListener
public AsyncListener getListener()
Returns the listener to be added to the asynchronous request or null.
-
isHasRequestAndResponse
public boolean isHasRequestAndResponse()
Returns whether a request and a response were set in this object.
-
getTimeout
public long getTimeout()
Returns the timeout, in milliseconds, for the asynchronous request. Any value less than or equal zero is considered not having set a timeout.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-