org.atmosphere.handler
Class ReflectorServletProcessor

java.lang.Object
  extended by org.atmosphere.handler.AbstractReflectorAtmosphereHandler
      extended by org.atmosphere.handler.ReflectorServletProcessor
All Implemented Interfaces:
AtmosphereHandler<HttpServletRequest,HttpServletResponse>, AtmosphereServletProcessor

public class ReflectorServletProcessor
extends AbstractReflectorAtmosphereHandler
implements AtmosphereServletProcessor

Simple AtmosphereServletProcessor that delegate the AtmosphereHandler.onRequest(org.atmosphere.cpr.AtmosphereResource) to a set of FilterChain and Servlet#service(javax.servlet.ServletRequest, javax.servlet.ServletResponse) and store the {@link AtmosphereResource} as a {@link HttpServletRequest} attribute named org.atmosphere.cpr.AtmosphereResource. The {@link AtmosphereResource} can later be retrieved and used to supend/resume and broadcast

Author:
Jeanfrancois Arcand

Constructor Summary
ReflectorServletProcessor()
           
 
Method Summary
 void destroy()
          Destroy the AtmosphereServletProcessor
 Servlet getServlet()
           
 String getServletClass()
          Deprecated. - use getServletClassName
 String getServletClassName()
          Set the Servlet class.
 void init(ServletConfig sc)
          Initialize the AtmosphereServletProcessor using the ServletConfig
 void onRequest(AtmosphereResource<HttpServletRequest,HttpServletResponse> r)
          Delegate the request to the Servlet.service method, and add the AtmosphereResource to the HttpServletRequest#setAttribute(java.lang.String, java.lang.Object)).
 void setFilterClassName(String filterClass)
          Add a FilterClass.
 void setServlet(Servlet servlet)
           
 void setServletClass(String servletClass)
          Deprecated. - use setServletClassName
 void setServletClassName(String servletClass)
          Return the Servlet class name.
 
Methods inherited from class org.atmosphere.handler.AbstractReflectorAtmosphereHandler
onStateChange
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.atmosphere.cpr.AtmosphereHandler
onStateChange
 

Constructor Detail

ReflectorServletProcessor

public ReflectorServletProcessor()
Method Detail

onRequest

public void onRequest(AtmosphereResource<HttpServletRequest,HttpServletResponse> r)
               throws IOException
Delegate the request to the Servlet.service method, and add the AtmosphereResource to the HttpServletRequest#setAttribute(java.lang.String, java.lang.Object)). The AtmosphereResource can ve retrieved using AtmosphereServlet.ATMOSPHERE_RESOURCE value.

Specified by:
onRequest in interface AtmosphereHandler<HttpServletRequest,HttpServletResponse>
Parameters:
r - The AtmosphereResource
Throws:
IOException

init

public void init(ServletConfig sc)
          throws ServletException
Description copied from interface: AtmosphereServletProcessor
Initialize the AtmosphereServletProcessor using the ServletConfig

Specified by:
init in interface AtmosphereServletProcessor
Parameters:
sc - the ServletConfig
Throws:
ServletException

destroy

public void destroy()
Description copied from interface: AtmosphereServletProcessor
Destroy the AtmosphereServletProcessor

Specified by:
destroy in interface AtmosphereServletProcessor

getServletClass

public String getServletClass()
Deprecated. - use getServletClassName

Set the Servlet class.

Returns:
the servletClass

setServletClass

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 -

getServlet

public Servlet getServlet()

setServlet

public void setServlet(Servlet servlet)


Copyright © 2010. All Rights Reserved.