Package org.apache.tapestry5.http

# Class AsyncRequestHandlerResponse

java.lang.Object
org.apache.tapestry5.http.AsyncRequestHandlerResponse

public class AsyncRequestHandlerResponse extends Object
Class used by AsyncRequestHandler to return information on how to handle a request.

See Also:
  - `AsyncRequestHandler`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `AsyncRequestHandlerResponse(Executor executor)`
  Creates an instance with a given `Executor`.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Executor`
  `getExecutor()`
  Returns the `Executor` to be used to process the request.
  `javax.servlet.AsyncListener`
  `getListener()`
  Returns the listener to be added to the asynchronous request or null.
  `javax.servlet.http.HttpServletRequest`
  `getRequest()`
  Returns the request to be used with `ServletRequest.startAsync()` or null.
  `javax.servlet.http.HttpServletResponse`
  `getResponse()`
  Returns the response to be used with `ServletRequest.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.
  `String`
  `toString()`
  `AsyncRequestHandlerResponse`
  `with(javax.servlet.AsyncListener listener)`
  Defines a listener to be added to the asynchronous request.
  `AsyncRequestHandlerResponse`
  `with(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)`
  Defines a different request and response to be passed to `ServletRequest.startAsync(javax.servlet.ServletRequest, javax.servlet.ServletResponse)`.
  `AsyncRequestHandlerResponse`
  `withTimeout(long timeout)`
  Sets the timeout for this asynchronous request in milliseconds.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- ## Constructor Details

  - ### AsyncRequestHandlerResponse

    public AsyncRequestHandlerResponse(Executor executor)
    Creates an instance with a given `Executor`. It cannot be null. If you want an instance with a non-async response, use `notHandled()` instead.
    Parameters:
      `executor` - a non-null `Executor`.

- ## Method Details

  - ### with

    public AsyncRequestHandlerResponse with(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
    Defines a different request and response to be passed to `ServletRequest.startAsync(javax.servlet.ServletRequest, javax.servlet.ServletResponse)`. Both cannot be null.

  - ### with

    public AsyncRequestHandlerResponse with(javax.servlet.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 Executor getExecutor()
    Returns the `Executor` to be used to process the request.

  - ### getRequest

    public javax.servlet.http.HttpServletRequest getRequest()
    Returns the request to be used with `ServletRequest.startAsync()` or null.

  - ### getResponse

    public javax.servlet.http.HttpServletResponse getResponse()
    Returns the response to be used with `ServletRequest.startAsync()` or null.

  - ### getListener

    public javax.servlet.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 String toString()
    Overrides:
      `toString` in class `Object`