Class DefaultAsyncContext

java.lang.Object
cloud.piranha.core.impl.DefaultAsyncContext
All Implemented Interfaces:
jakarta.servlet.AsyncContext

public class DefaultAsyncContext extends Object implements jakarta.servlet.AsyncContext
The default AsyncContext.
Author:
Manfred Riem ([email protected])
  • Field Summary

    Fields inherited from interface jakarta.servlet.AsyncContext

    ASYNC_CONTEXT_PATH, ASYNC_MAPPING, ASYNC_PATH_INFO, ASYNC_QUERY_STRING, ASYNC_REQUEST_URI, ASYNC_SERVLET_PATH
  • Constructor Summary

    Constructors
    Constructor
    Description
    DefaultAsyncContext(jakarta.servlet.ServletRequest asyncStartRequest, jakarta.servlet.ServletResponse asyncStartResponse)
    Constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addListener(jakarta.servlet.AsyncListener listener)
    Add the listener.
    void
    addListener(jakarta.servlet.AsyncListener listener, jakarta.servlet.ServletRequest request, jakarta.servlet.ServletResponse response)
    Add the listener.
    void
    Complete the async context.
    <T extends jakarta.servlet.AsyncListener>
    T
    Create the listener.
    void
     
    void
    dispatch(jakarta.servlet.ServletContext servletContext, String path)
    Dispatch.
    void
     
    jakarta.servlet.ServletRequest
    Returns the asyncStartRequest.
    jakarta.servlet.ServletResponse
    Returns the asyncStartResponse.
    long
    Returns the timeout.
    boolean
    Do we have the original asyncStartRequest and asyncStartResponse?
    void
    Process on timeout
    void
    setTimeout(long timeout)
    Set the timeout.
    void
    start(Runnable runnable)
    Start the thread.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • DefaultAsyncContext

      public DefaultAsyncContext(jakarta.servlet.ServletRequest asyncStartRequest, jakarta.servlet.ServletResponse asyncStartResponse)
      Constructor.
      Parameters:
      asyncStartRequest - the servlet asyncStartRequest.
      asyncStartResponse - the servlet asyncStartResponse.
  • Method Details

    • addListener

      public void addListener(jakarta.servlet.AsyncListener listener)
      Add the listener.
      Specified by:
      addListener in interface jakarta.servlet.AsyncContext
      Parameters:
      listener - the listener.
      See Also:
      • AsyncContext.addListener(jakarta.servlet.AsyncListener)
    • addListener

      public void addListener(jakarta.servlet.AsyncListener listener, jakarta.servlet.ServletRequest request, jakarta.servlet.ServletResponse response)
      Add the listener.
      Specified by:
      addListener in interface jakarta.servlet.AsyncContext
      Parameters:
      listener - the listener.
      request - the servlet asyncStartRequest.
      response - the servlet asyncStartResponse.
    • createListener

      public <T extends jakarta.servlet.AsyncListener> T createListener(Class<T> type) throws jakarta.servlet.ServletException
      Create the listener.
      Specified by:
      createListener in interface jakarta.servlet.AsyncContext
      Type Parameters:
      T - the class.
      Parameters:
      type - the type.
      Returns:
      the listener.
      Throws:
      jakarta.servlet.ServletException - when a Servlet error occurs.
    • dispatch

      public void dispatch()
      Specified by:
      dispatch in interface jakarta.servlet.AsyncContext
      See Also:
      • AsyncContext.dispatch()
    • dispatch

      public void dispatch(String path)
      Specified by:
      dispatch in interface jakarta.servlet.AsyncContext
      See Also:
      • AsyncContext.dispatch(java.lang.String)
    • dispatch

      public void dispatch(jakarta.servlet.ServletContext servletContext, String path)
      Dispatch.
      Specified by:
      dispatch in interface jakarta.servlet.AsyncContext
      Parameters:
      servletContext - the servlet context.
      path - the path.
    • complete

      public void complete()
      Complete the async context.
      Specified by:
      complete in interface jakarta.servlet.AsyncContext
    • onTimeOut

      public void onTimeOut()
      Process on timeout
    • getRequest

      public jakarta.servlet.ServletRequest getRequest()
      Returns the asyncStartRequest.
      Specified by:
      getRequest in interface jakarta.servlet.AsyncContext
      Returns:
      the asyncStartRequest
      See Also:
      • AsyncContext.getRequest()
    • getResponse

      public jakarta.servlet.ServletResponse getResponse()
      Returns the asyncStartResponse.
      Specified by:
      getResponse in interface jakarta.servlet.AsyncContext
      Returns:
      the asyncStartResponse
      See Also:
      • AsyncContext.getResponse()
    • getTimeout

      public long getTimeout()
      Returns the timeout.
      Specified by:
      getTimeout in interface jakarta.servlet.AsyncContext
      Returns:
      the timeout
      See Also:
      • AsyncContext.getTimeout()
    • hasOriginalRequestAndResponse

      public boolean hasOriginalRequestAndResponse()
      Do we have the original asyncStartRequest and asyncStartResponse?
      Specified by:
      hasOriginalRequestAndResponse in interface jakarta.servlet.AsyncContext
      Returns:
      true if we do, false otherwise.
    • setTimeout

      public void setTimeout(long timeout)
      Set the timeout.
      Specified by:
      setTimeout in interface jakarta.servlet.AsyncContext
      Parameters:
      timeout - the timeout.
    • start

      public void start(Runnable runnable)
      Start the thread.
      Specified by:
      start in interface jakarta.servlet.AsyncContext
      Parameters:
      runnable - the runnable.