AsyncListenerWrapper (Apache Tomcat 9.0.120 API Documentation)
Description: declaration: package: org.apache.catalina.core, class: AsyncListenerWrapper

# Class AsyncListenerWrapper

java.lang.Object
org.apache.catalina.core.AsyncListenerWrapper

public class AsyncListenerWrapper extends Object
Wrapper for an `AsyncListener` that supports custom request and response objects for event customization.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `AsyncListenerWrapper()`
  Default constructor.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `fireOnComplete(AsyncEvent event)`
  Fires the onComplete event on the wrapped listener.
  `void`
  `fireOnError(AsyncEvent event)`
  Fires the onError event on the wrapped listener.
  `void`
  `fireOnStartAsync(AsyncEvent event)`
  Fires the onStartAsync event on the wrapped listener.
  `void`
  `fireOnTimeout(AsyncEvent event)`
  Fires the onTimeout event on the wrapped listener.
  `AsyncListener`
  `getListener()`
  Returns the wrapped async listener.
  `void`
  `setListener(AsyncListener listener)`
  Sets the async listener to wrap.
  `void`
  `setServletRequest(ServletRequest servletRequest)`
  Sets the custom servlet request to use for events.
  `void`
  `setServletResponse(ServletResponse servletResponse)`
  Sets the custom servlet response to use for events.

  ### Methods inherited from class Object

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

- ## Constructor Details

  - ### AsyncListenerWrapper

    public AsyncListenerWrapper()
    Default constructor.

- ## Method Details

  - ### fireOnStartAsync

    public void fireOnStartAsync(AsyncEvent event) throws IOException
    Fires the onStartAsync event on the wrapped listener.
    Parameters:
      `event` - The async event
    Throws:
      `IOException` - if an I/O error occurs

  - ### fireOnComplete

    public void fireOnComplete(AsyncEvent event) throws IOException
    Fires the onComplete event on the wrapped listener.
    Parameters:
      `event` - The async event
    Throws:
      `IOException` - if an I/O error occurs

  - ### fireOnTimeout

    public void fireOnTimeout(AsyncEvent event) throws IOException
    Fires the onTimeout event on the wrapped listener.
    Parameters:
      `event` - The async event
    Throws:
      `IOException` - if an I/O error occurs

  - ### fireOnError

    public void fireOnError(AsyncEvent event) throws IOException
    Fires the onError event on the wrapped listener.
    Parameters:
      `event` - The async event
    Throws:
      `IOException` - if an I/O error occurs

  - ### getListener

    public AsyncListener getListener()
    Returns the wrapped async listener.
    Returns:
      the async listener

  - ### setListener

    public void setListener(AsyncListener listener)
    Sets the async listener to wrap.
    Parameters:
      `listener` - the async listener

  - ### setServletRequest

    public void setServletRequest(ServletRequest servletRequest)
    Sets the custom servlet request to use for events.
    Parameters:
      `servletRequest` - the servlet request

  - ### setServletResponse

    public void setServletResponse(ServletResponse servletResponse)
    Sets the custom servlet response to use for events.
    Parameters:
      `servletResponse` - the servlet response