org.clazzes.remoting.beans
Class OpenClientContextInViewFilter

java.lang.Object
  extended by org.springframework.web.filter.GenericFilterBean
      extended by org.springframework.web.filter.OncePerRequestFilter
          extended by org.clazzes.remoting.beans.OpenClientContextInViewFilter
All Implemented Interfaces:
javax.servlet.Filter, org.springframework.beans.factory.BeanNameAware, org.springframework.beans.factory.DisposableBean, org.springframework.beans.factory.InitializingBean, org.springframework.web.context.ServletContextAware

public class OpenClientContextInViewFilter
extends org.springframework.web.filter.OncePerRequestFilter

Servlet 2.4 Filter that binds a remote Session to the thread for the entire processing of the request. This filter makes a remote Session context available via the current thread, which will be autodetected by BeanImporter. In order to use this class you need to use the optional spring dependency.

Author:
wglas

Field Summary
static java.lang.String DEFAULT_CLIENT_MANAGER_BEAN_NAME
           
static java.lang.String DEFAULT_SESSION_CONTEXT_SUBSYTEM
           
 
Fields inherited from class org.springframework.web.filter.OncePerRequestFilter
ALREADY_FILTERED_SUFFIX
 
Fields inherited from class org.springframework.web.filter.GenericFilterBean
logger
 
Constructor Summary
OpenClientContextInViewFilter()
           
 
Method Summary
protected  void doFilterInternal(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, javax.servlet.FilterChain filterChain)
           
protected  java.lang.String getClientManagerBeanName()
          Return the bean name of the SessionContextFactory to fetch from Spring's root application context.
 java.lang.String getExcludeServices()
           
 java.lang.String getOverrideFormCharset()
           
 java.lang.String getSessionAuthenticatorBeanName()
           
protected  java.lang.String getSessionContextSubSystem()
           
protected  ClientManager lookupClientManager()
          Look up the ClientManager that this filter should use.
protected  SessionAuthenticator lookupSessionAuthenticator()
          Look up the SessionAuthenticator that this filter should use.
protected  ClientHolder makeClientHolder(Client client)
           
 void setClientManagerBeanName(java.lang.String sessionContextFactoryBeanName)
          Set the bean name of the SessionContextFactory to fetch from Spring's root application context.
 void setExcludeServices(java.lang.String excludeServices)
           
 void setOverrideFormCharset(java.lang.String overrideFormCharset)
           
 void setSessionAuthenticatorBeanName(java.lang.String sessionAuthenticatorBeanName)
           
 void setSessionContextSubSystem(java.lang.String sessionContextSubSystem)
           
 
Methods inherited from class org.springframework.web.filter.OncePerRequestFilter
doFilter, getAlreadyFilteredAttributeName, shouldNotFilter
 
Methods inherited from class org.springframework.web.filter.GenericFilterBean
addRequiredProperty, afterPropertiesSet, destroy, getFilterConfig, getFilterName, getServletContext, init, initBeanWrapper, initFilterBean, setBeanName, setServletContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_CLIENT_MANAGER_BEAN_NAME

public static final java.lang.String DEFAULT_CLIENT_MANAGER_BEAN_NAME
See Also:
Constant Field Values

DEFAULT_SESSION_CONTEXT_SUBSYTEM

public static final java.lang.String DEFAULT_SESSION_CONTEXT_SUBSYTEM
See Also:
Constant Field Values
Constructor Detail

OpenClientContextInViewFilter

public OpenClientContextInViewFilter()
Method Detail

setClientManagerBeanName

public void setClientManagerBeanName(java.lang.String sessionContextFactoryBeanName)
Set the bean name of the SessionContextFactory to fetch from Spring's root application context. Default is "sessionContextFactory".

See Also:
DEFAULT_CLIENT_MANAGER_BEAN_NAME

getClientManagerBeanName

protected java.lang.String getClientManagerBeanName()
Return the bean name of the SessionContextFactory to fetch from Spring's root application context.


makeClientHolder

protected ClientHolder makeClientHolder(Client client)

getSessionContextSubSystem

protected java.lang.String getSessionContextSubSystem()
Returns:
the sessionContextSubSystem

setSessionContextSubSystem

public void setSessionContextSubSystem(java.lang.String sessionContextSubSystem)
Parameters:
sessionContextSubSystem - the sessionContextSubSystem to set

doFilterInternal

protected void doFilterInternal(javax.servlet.http.HttpServletRequest request,
                                javax.servlet.http.HttpServletResponse response,
                                javax.servlet.FilterChain filterChain)
                         throws javax.servlet.ServletException,
                                java.io.IOException
Specified by:
doFilterInternal in class org.springframework.web.filter.OncePerRequestFilter
Throws:
javax.servlet.ServletException
java.io.IOException

lookupClientManager

protected ClientManager lookupClientManager()
Look up the ClientManager that this filter should use. The default implementation looks for a bean with the specified name in Spring's root application context.

Returns:
the ClientManager to use.
See Also:
getClientManagerBeanName()

getExcludeServices

public java.lang.String getExcludeServices()
Returns:
A comma-separated list of tapestry service names to exclude from session interception.

setExcludeServices

public void setExcludeServices(java.lang.String excludeServices)
Parameters:
excludeServices - A comma-separated list of tapestry service names to exclude from session interception.

getSessionAuthenticatorBeanName

public java.lang.String getSessionAuthenticatorBeanName()
Returns:
The name of the session authenticator bean.

setSessionAuthenticatorBeanName

public void setSessionAuthenticatorBeanName(java.lang.String sessionAuthenticatorBeanName)
Parameters:
sessionAuthenticatorBeanName - The name of the session authenticator bean.

lookupSessionAuthenticator

protected SessionAuthenticator lookupSessionAuthenticator()
Look up the SessionAuthenticator that this filter should use. The default implementation looks for a bean with the specified name in Spring's root application context.

Returns:
the SessionAuthenticator to use or null, if the client authenticator bean name has not been configured.
See Also:
getSessionAuthenticatorBeanName()

getOverrideFormCharset

public java.lang.String getOverrideFormCharset()
Returns:
The charset used to decode POST variables. This is needed, if getExcludeServices() is not null and you experience encoding problem in the downstream web application. The configured string is passed to ServletRequest.setCharacterEncoding(String).

setOverrideFormCharset

public void setOverrideFormCharset(java.lang.String overrideFormCharset)
Parameters:
overrideFormCharset - The charset used to decode POST variables. This is needed, if getExcludeServices() is not null and you experience encoding problem in the downstream web application. The configured string is passed to ServletRequest.setCharacterEncoding(String).


Copyright © 2010. All Rights Reserved.