com.interface21.web.servlet.theme
Class SessionThemeResolver

java.lang.Object
  |
  +--com.interface21.web.servlet.theme.AbstractThemeResolver
        |
        +--com.interface21.web.servlet.theme.SessionThemeResolver
All Implemented Interfaces:
ThemeResolver

public class SessionThemeResolver
extends AbstractThemeResolver

Implementation of ThemeResolver that uses a theme attribute in the user's session in case of a custom setting, with a fallback to the fixed default theme. This is most appropriate if the application needs user sessions anyway.

Custom controllers can override the user's theme by calling setTheme, e.g. responding to a theme change request.

Since:
17.06.2003
Author:
Jean-Pierre Pawlak, Juergen Hoeller

Field Summary
static java.lang.String THEME_SESSION_ATTRIBUTE_NAME
           
 
Fields inherited from class com.interface21.web.servlet.theme.AbstractThemeResolver
ORIGINAL_DEFAULT_THEME_NAME
 
Constructor Summary
SessionThemeResolver()
           
 
Method Summary
 java.lang.String resolveThemeName(javax.servlet.http.HttpServletRequest request)
          Resolve the current theme name via the given request.
 void setThemeName(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.lang.String themeName)
          Set the current theme name to the given one.
 
Methods inherited from class com.interface21.web.servlet.theme.AbstractThemeResolver
getDefaultThemeName, setDefaultThemeName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

THEME_SESSION_ATTRIBUTE_NAME

public static final java.lang.String THEME_SESSION_ATTRIBUTE_NAME
Constructor Detail

SessionThemeResolver

public SessionThemeResolver()
Method Detail

resolveThemeName

public java.lang.String resolveThemeName(javax.servlet.http.HttpServletRequest request)
Description copied from interface: ThemeResolver
Resolve the current theme name via the given request. Should return a default theme as fallback in any case.
Following copied from interface: com.interface21.web.servlet.ThemeResolver
Parameters:
request - request to be used for resolution
Returns:
the current theme name

setThemeName

public void setThemeName(javax.servlet.http.HttpServletRequest request,
                         javax.servlet.http.HttpServletResponse response,
                         java.lang.String themeName)
Description copied from interface: ThemeResolver
Set the current theme name to the given one.
Following copied from interface: com.interface21.web.servlet.ThemeResolver
Parameters:
request - request to be used for theme name modification
response - response to be used for theme name modification
themeName - the new theme name


Rod Johnson and Spring contributors 2001-2003.