net.sf.gwtspringrpc.http
Class SingletonHttpServletRequestFactoryBean

java.lang.Object
  extended by net.sf.gwtspringrpc.http.SingletonHttpServletRequestFactoryBean
All Implemented Interfaces:
InvocationHandler, FactoryBean

public class SingletonHttpServletRequestFactoryBean
extends Object
implements FactoryBean, InvocationHandler

This class is a factory bean for creating a singleton HttpServletRequest dynamic proxy instance. This allows the HttpServletRequest to be injected into singleton beans but still manage a separate instance per thread.

Since:
1.0
Author:
Mike Clemens

Field Summary
private  Log log
           
 
Constructor Summary
SingletonHttpServletRequestFactoryBean()
           
 
Method Summary
 Object getObject()
          Returns a dynamic HttpServletRequest proxy delegating method requests to the instance stored in HTTPObjectHolder.
 Class getObjectType()
          Retrieves the object type of HttpServletRequest.
 Object invoke(Object proxy, Method method, Object[] args)
          Invokes a method on the dynamic HttpServletRequest proxy.
 boolean isSingleton()
          Returns true since this factory bean creates a singleton.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private final Log log
Constructor Detail

SingletonHttpServletRequestFactoryBean

public SingletonHttpServletRequestFactoryBean()
Method Detail

getObjectType

public Class getObjectType()
Retrieves the object type of HttpServletRequest.

Specified by:
getObjectType in interface FactoryBean
Returns:
The HttpServletRequest class

isSingleton

public boolean isSingleton()
Returns true since this factory bean creates a singleton.

Specified by:
isSingleton in interface FactoryBean
Returns:
True

getObject

public Object getObject()
                 throws Exception
Returns a dynamic HttpServletRequest proxy delegating method requests to the instance stored in HTTPObjectHolder.

Specified by:
getObject in interface FactoryBean
Returns:
The dynamic HttpServletRequest proxy
Throws:
Exception - Any uncaught exceptions will cause the Spring application context initialization to fail

invoke

public Object invoke(Object proxy,
                     Method method,
                     Object[] args)
              throws Throwable
Invokes a method on the dynamic HttpServletRequest proxy.

Specified by:
invoke in interface InvocationHandler
Parameters:
proxy - This instance
method - The method being invoked
args - The method arguments
Throws:
Throwable - If an exception occurs invoking the method