Class ReflectorServletProcessor

java.lang.Object
org.atmosphere.handler.AbstractReflectorAtmosphereHandler
org.atmosphere.handler.ReflectorServletProcessor
All Implemented Interfaces:
AtmosphereHandler, AtmosphereServletProcessor

public class ReflectorServletProcessor extends AbstractReflectorAtmosphereHandler
An implementation of AtmosphereHandler using the AtmosphereServletProcessor that delegate the AtmosphereHandler.onRequest(org.atmosphere.cpr.AtmosphereResource) to a set of FilterChain and Servlet.service(jakarta.servlet.ServletRequest, jakarta.servlet.ServletResponse) and store the AtmosphereResource as a AtmosphereRequestImpl.getAttribute(String) attribute named FrameworkConfig.ATMOSPHERE_RESOURCE. The AtmosphereResource can later be retrieved and used to suspend/resume and broadcast.
Author:
Jeanfrancois Arcand
  • Constructor Details

    • ReflectorServletProcessor

      public ReflectorServletProcessor()
    • ReflectorServletProcessor

      public ReflectorServletProcessor(jakarta.servlet.Servlet servlet)
  • Method Details

    • onRequest

      public void onRequest(AtmosphereResource r) throws IOException
      Delegate the request to the Servlet.service method, and add the AtmosphereResource to the
      invalid @link
      {@link HttpServletRequest#setAttribute(java.lang.String, java.lang.Object))
      }. The AtmosphereResource can ve retrieved using FrameworkConfig.ATMOSPHERE_RESOURCE value.
      Parameters:
      r - The AtmosphereResource
      Throws:
      IOException
    • init

      public void init(AtmosphereConfig config) throws jakarta.servlet.ServletException
      Description copied from interface: AtmosphereServletProcessor
      Initialize the AtmosphereServletProcessor using the ServletConfig.
      Specified by:
      init in interface AtmosphereServletProcessor
      Overrides:
      init in class AbstractReflectorAtmosphereHandler
      Parameters:
      config - the ServletConfig
      Throws:
      jakarta.servlet.ServletException
    • addFilter

      public void addFilter(jakarta.servlet.Filter filter)
    • destroy

      public void destroy()
      Description copied from interface: AtmosphereHandler
      Destroy this handler
      Specified by:
      destroy in interface AtmosphereHandler
      Overrides:
      destroy in class AbstractReflectorAtmosphereHandler
    • getServletClass

      @Deprecated public String getServletClass()
      Deprecated.
      - use getServletClassName
      Set the Servlet class.
      Returns:
      the servletClass
    • setServletClass

      @Deprecated public void setServletClass(String servletClass)
      Deprecated.
      - use setServletClassName
      Return the Servlet class name.
      Parameters:
      servletClass - the servletClass to set
    • getServletClassName

      public String getServletClassName()
      Set the Servlet class.
      Returns:
      the servletClass
    • setServletClassName

      public void setServletClassName(String servletClass)
      Return the Servlet class name.
      Parameters:
      servletClass - the servletClass to set
    • setFilterClassName

      public void setFilterClassName(String filterClass)
      Add a FilterClass. Since we are using Reflection to call this method, what we are really doing is addFilterClass.

      Parameters:
      filterClass -
    • addFilterClassName

      public void addFilterClassName(String filterClass, String filterName)
      Add a FilterClass. Since we are using Reflection to call this method, what we are really doing is addFilterClass.
      Parameters:
      filterClass - class name of the filter to instantiate.
      filterName - mapping name of the filter to instantiate
    • getServlet

      public jakarta.servlet.Servlet getServlet()
    • setServlet

      public void setServlet(jakarta.servlet.Servlet servlet)
    • toString

      public String toString()
      Overrides:
      toString in class Object