Interface ThemeResolver

  • All Known Implementing Classes:
    CookieThemeResolver

    public interface ThemeResolver
    Interface for web-based theme resolution strategies that allows for both theme resolution via the request and theme selection via request and response. This interface allows for implementations based on session, cookies, etc. The default implementation is CookieThemeResolver, which uses cookie for theme resolution and selection. Note that this resolver is only responsible for determining the current theme name. The Theme instance for the resolved theme name must be looked up via ThemeRegistry interface. For example, the user could call ThemeFns.getThemeRegistry() to obtain the current theme registry, and then call themeRegistry.getTheme(themeName) to retrieve the corresponding Theme instance, if a theme with such name is previously registered.
    Since:
    6.5.2
    Author:
    neillee
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      java.lang.String getTheme​(javax.servlet.http.HttpServletRequest request)
      Resolve the current intended theme name via the given request.
      void setTheme​(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.lang.String themeName)
      Set the current intended theme name to the given one.
    • Method Detail

      • getTheme

        java.lang.String getTheme​(javax.servlet.http.HttpServletRequest request)
        Resolve the current intended theme name via the given request. Whether this theme name will actually be used is subject to the theme validation and fall-back strategies.
        Parameters:
        request - request to be used for resolution
        Returns:
        the current intended theme name
      • setTheme

        void setTheme​(javax.servlet.http.HttpServletRequest request,
                      javax.servlet.http.HttpServletResponse response,
                      java.lang.String themeName)
        Set the current intended theme name to the given one.
        Parameters:
        request - request to be used for theme name selection
        response - response to be used for theme name selection
        themeName - the new intended theme name