Package org.springframework.web.servlet

Examples of org.springframework.web.servlet.ThemeResolver



  public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
      throws ServletException {

    ThemeResolver themeResolver = RequestContextUtils.getThemeResolver(request);
    if (themeResolver == null) {
      throw new IllegalStateException("No ThemeResolver found: not in a DispatcherServlet request?");
    }
    String newTheme = request.getParameter(this.paramName);
    if (newTheme != null) {
      themeResolver.setThemeName(request, response, newTheme);
    }
    // Proceed in any case.
    return true;
  }
View Full Code Here


   * @param request current HTTP request
   * @return the current theme, or <code>null</code> if not found
   * @see #getThemeResolver
   */
  public static Theme getTheme(HttpServletRequest request) {
    ThemeResolver themeResolver = getThemeResolver(request);
    ThemeSource themeSource = getThemeSource(request);
    if (themeResolver != null && themeSource != null) {
      String themeName = themeResolver.resolveThemeName(request);
      return themeSource.getTheme(themeName);
    }
    else {
      return null;
    }
View Full Code Here

   * @param request current HTTP request
   * @return the current theme, or <code>null</code> if not found
   * @see #getThemeResolver
   */
  public static Theme getTheme(HttpServletRequest request) {
    ThemeResolver themeResolver = getThemeResolver(request);
    ThemeSource themeSource = getThemeSource(request);
    if (themeResolver != null && themeSource != null) {
      String themeName = themeResolver.resolveThemeName(request);
      return themeSource.getTheme(themeName);
    }
    else {
      return null;
    }
View Full Code Here

   * @param request current HTTP request
   * @return the current theme, or <code>null</code> if not found
   * @see #getThemeResolver
   */
  public static Theme getTheme(HttpServletRequest request) {
    ThemeResolver themeResolver = getThemeResolver(request);
    ThemeSource themeSource = getThemeSource(request);
    if (themeResolver != null && themeSource != null) {
      String themeName = themeResolver.resolveThemeName(request);
      return themeSource.getTheme(themeName);
    }
    else {
      return null;
    }
View Full Code Here


  public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
      throws ServletException {

    ThemeResolver themeResolver = RequestContextUtils.getThemeResolver(request);
    if (themeResolver == null) {
      throw new IllegalStateException("No ThemeResolver found: not in a DispatcherServlet request?");
    }
    String newTheme = request.getParameter(this.paramName);
    if (newTheme != null) {
      themeResolver.setThemeName(request, response, newTheme);
    }
    // Proceed in any case.
    return true;
  }
View Full Code Here

   * @param request current HTTP request
   * @return the current theme, or <code>null</code> if not found
   * @see #getThemeResolver
   */
  public static Theme getTheme(HttpServletRequest request) {
    ThemeResolver themeResolver = getThemeResolver(request);
    ThemeSource themeSource = getThemeSource(request);
    if (themeResolver != null && themeSource != null) {
      String themeName = themeResolver.resolveThemeName(request);
      return themeSource.getTheme(themeName);
    }
    else {
      return null;
    }
View Full Code Here

    MockHttpServletResponse response = new MockHttpServletResponse();
    if (inDispatcherServlet()) {
      request.setAttribute(DispatcherServlet.WEB_APPLICATION_CONTEXT_ATTRIBUTE, wac);
      LocaleResolver lr = new AcceptHeaderLocaleResolver();
      request.setAttribute(DispatcherServlet.LOCALE_RESOLVER_ATTRIBUTE, lr);
      ThemeResolver tr = new FixedThemeResolver();
      request.setAttribute(DispatcherServlet.THEME_RESOLVER_ATTRIBUTE, tr);
      request.setAttribute(DispatcherServlet.THEME_SOURCE_ATTRIBUTE, wac);
    }
    else {
      sc.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, wac);
View Full Code Here

   * @param request current HTTP request
   * @return the current theme, or <code>null</code> if not found
   * @see #getThemeResolver
   */
  public static Theme getTheme(HttpServletRequest request) {
    ThemeResolver themeResolver = getThemeResolver(request);
    ThemeSource themeSource = getThemeSource(request);
    if (themeResolver != null && themeSource != null) {
      String themeName = themeResolver.resolveThemeName(request);
      return themeSource.getTheme(themeName);
    }
    else {
      return null;
    }
View Full Code Here

  public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
      throws ServletException {

    String newTheme = request.getParameter(this.paramName);
    if (newTheme != null) {
      ThemeResolver themeResolver = RequestContextUtils.getThemeResolver(request);
      if (themeResolver == null) {
        throw new IllegalStateException("No ThemeResolver found: not in a DispatcherServlet request?");
      }
      themeResolver.setThemeName(request, response, newTheme);
    }
    // Proceed in any case.
    return true;
  }
View Full Code Here

   * storing the new theme name through the configured {@link ThemeResolver}.
   * @param theme the new theme
   * @see ThemeResolver#setThemeName
   */
  public void changeTheme(Theme theme) {
    ThemeResolver themeResolver = RequestContextUtils.getThemeResolver(this.request);
    if (themeResolver == null) {
      throw new IllegalStateException("Cannot change theme if no ThemeResolver configured");
    }
    themeResolver.setThemeName(this.request, this.response, (theme != null ? theme.getName() : null));
    this.theme = theme;
  }
View Full Code Here

TOP

Related Classes of org.springframework.web.servlet.ThemeResolver

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.