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

Field Summary
static String ATMOSPHERE_HANDLER
           
static String ATMOSPHERE_RESOURCE
           
 
Constructor Summary
ReflectorServletProcessor()
           
 
Method Summary
 void destroy()
          Destroy the AtmosphereServletProcessor
 String getServletClass()
          Set the Servlet class.
 void init(ServletConfig sc)
          Initialize the AtmosphereServletProcessor using the E
 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 setFilterClass(String filterClass)
          Add a FilterClass.
 void setServletClass(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
 

Field Detail

ATMOSPHERE_RESOURCE

public static final String ATMOSPHERE_RESOURCE

ATMOSPHERE_HANDLER

public static final String ATMOSPHERE_HANDLER
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 ATMOSPHERE_RESOURCE value.

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

init

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

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

destroy

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

Specified by:
destroy in interface AtmosphereServletProcessor

getServletClass

public String getServletClass()
Set the Servlet class.

Returns:
the servletClass

setServletClass

public void setServletClass(String servletClass)
Return the Servlet class name.

Parameters:
servletClass - the servletClass to set

setFilterClass

public void setFilterClass(String filterClass)
Add a FilterClass. Since we are using Reflection to call this method, what we are really doing is addFilterClass. TODO: Improve Relection Support



Copyright © 2009 SUN Microsystems. All Rights Reserved.