1 16 17 package org.springframework.web.servlet.theme; 18 19 import javax.servlet.http.HttpServletRequest ; 20 import javax.servlet.http.HttpServletResponse ; 21 22 import org.springframework.web.util.WebUtils; 23 24 37 public class SessionThemeResolver extends AbstractThemeResolver { 38 39 47 public static final String THEME_SESSION_ATTRIBUTE_NAME = SessionThemeResolver.class.getName() + ".THEME"; 48 49 public String resolveThemeName(HttpServletRequest request) { 50 String theme = (String ) WebUtils.getSessionAttribute(request, THEME_SESSION_ATTRIBUTE_NAME); 51 return (theme != null ? theme : getDefaultThemeName()); 53 } 54 55 public void setThemeName(HttpServletRequest request, HttpServletResponse response, String themeName) { 56 WebUtils.setSessionAttribute(request, THEME_SESSION_ATTRIBUTE_NAME, themeName); 57 } 58 59 } 60 | Popular Tags |