Codota Logo
ThemeResolver.setThemeName
Code IndexAdd Codota to your IDE (free)

How to use
setThemeName
method
in
org.springframework.web.servlet.ThemeResolver

Best Java code snippets using org.springframework.web.servlet.ThemeResolver.setThemeName (Showing top 17 results out of 315)

  • Common ways to obtain ThemeResolver
private void myMethod () {
ThemeResolver t =
  • Codota IconHttpServletRequest request;RequestContextUtils.getThemeResolver(request)
  • Codota IconHttpServletRequest httpServletRequest;String str;(ThemeResolver) httpServletRequest.getAttribute(str)
  • Smart code suggestions by Codota
}
origin: spring-projects/spring-framework

@Override
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;
}
origin: spring-projects/spring-framework

/**
 * Change the current theme to the specified theme by name,
 * storing the new theme name through the configured {@link ThemeResolver}.
 * @param themeName the name of the new theme
 * @see ThemeResolver#setThemeName
 */
public void changeTheme(String themeName) {
  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, themeName);
  // Ask for re-resolution on next getTheme call.
  this.theme = null;
}
origin: spring-projects/spring-framework

/**
 * Change the current theme to the specified one,
 * storing the new theme name through the configured {@link ThemeResolver}.
 * @param theme the new theme
 * @see ThemeResolver#setThemeName
 */
public void changeTheme(@Nullable 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;
}
origin: org.springframework/spring-webmvc

@Override
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;
}
origin: org.springframework/spring-webmvc

/**
 * Change the current theme to the specified theme by name,
 * storing the new theme name through the configured {@link ThemeResolver}.
 * @param themeName the name of the new theme
 * @see ThemeResolver#setThemeName
 */
public void changeTheme(String themeName) {
  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, themeName);
  // Ask for re-resolution on next getTheme call.
  this.theme = null;
}
origin: org.springframework/spring-webmvc

/**
 * Change the current theme to the specified one,
 * storing the new theme name through the configured {@link ThemeResolver}.
 * @param theme the new theme
 * @see ThemeResolver#setThemeName
 */
public void changeTheme(@Nullable 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;
}
origin: spring-projects/spring-framework

private void internalTest(ThemeResolver themeResolver, boolean shouldSet, String defaultName) {
  // create mocks
  MockServletContext context = new MockServletContext();
  MockHttpServletRequest request = new MockHttpServletRequest(context);
  MockHttpServletResponse response = new MockHttpServletResponse();
  // check original theme
  String themeName = themeResolver.resolveThemeName(request);
  assertEquals(themeName, defaultName);
  // set new theme name
  try {
    themeResolver.setThemeName(request, response, TEST_THEME_NAME);
    if (!shouldSet)
      fail("should not be able to set Theme name");
    // check new theme namelocale
    themeName = themeResolver.resolveThemeName(request);
    assertEquals(TEST_THEME_NAME, themeName);
    themeResolver.setThemeName(request, response, null);
    themeName = themeResolver.resolveThemeName(request);
    assertEquals(themeName, defaultName);
  }
  catch (UnsupportedOperationException ex) {
    if (shouldSet)
      fail("should be able to set Theme name");
  }
}
origin: org.fujion/fujion-core

@Override
public void setThemeName(HttpServletRequest request, HttpServletResponse response, String themeName) {
  themeName = StringUtils.hasText(themeName) ? themeName : defaultTheme;
  
  for (ThemeResolver themeResolver : themeResolvers) {
    themeResolver.setThemeName(request, response, themeName);
  }
}

origin: apache/servicemix-bundles

@Override
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;
}
origin: cn.jeeweb/jeeweb-beetl-tag

/**
 * Change the current theme to the specified theme by name,
 * storing the new theme name through the configured {@link ThemeResolver}.
 * @param themeName the name of the new theme
 * @see ThemeResolver#setThemeName
 */
public void changeTheme(String themeName) {
  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, themeName);
  // Ask for re-resolution on next getTheme call.
  this.theme = null;
}
origin: apache/servicemix-bundles

/**
 * Change the current theme to the specified one,
 * 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;
}
origin: org.hsweb/hsweb-web-controller

  @Override
  public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws ServletException {
    String newTheme = request.getParameter(getParamName());
    if (newTheme != null) {
      ThemeResolver themeResolver = cookieThemeResolver();
      if (themeResolver != null) {
        themeResolver.setThemeName(request, response, newTheme);
      }
    }
    return true;
  }
};
origin: cn.jeeweb/jeeweb-beetl-tag

/**
 * Change the current theme to the specified one,
 * storing the new theme name through the configured {@link ThemeResolver}.
 * @param theme the new theme
 * @see ThemeResolver#setThemeName
 */
public void changeTheme(@Nullable 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;
}
origin: com.github.vindell/spring-biz

@Override
public void setThemeName(HttpServletRequest request, HttpServletResponse response, String themeName) {
  if (isNested()) {
    for (ThemeResolver localeResolver : getResolvers()) {
      localeResolver.setThemeName(request, response, themeName);
    }
  }
}
origin: org.tinygroup/org.tinygroup.springmvc

public void setThemeName(HttpServletRequest request,
             HttpServletResponse response, String themeName) {
  ThemeResolver themeResolver = RequestInstanceHolder
      .getMappingInstance().getCommonThemeResolver();
  if (themeResolver != null) {
    logger.logMessage(LogLevel.DEBUG,
        " invoke themeResolver.setThemeName() method that will proxy ["
            + themeResolver + "]");
    themeResolver.setThemeName(request, response, themeName);
  }
}
origin: pl.edu.icm.synat/synat-portal-core

themeResolver.setThemeName(request, response, newTheme);
origin: pl.edu.icm.synat/synat-portal-core

@Override
public void postHandle(HttpServletRequest request,
    HttpServletResponse response, Object handler,
    ModelAndView modelAndView) throws Exception {
  Locale locale = localeResolver.resolveLocale(request);
  userSettingsHolder.setLocale(locale);
  localeResolver.setLocale(request, response, locale);
  String themeName = themeResolver.resolveThemeName(request);
  userSettingsHolder.setTheme(themeName);
  themeResolver.setThemeName(request, response, themeName);
  final String timezone = timezoneResolver.resolveSetting(request);
  userSettingsHolder.setTimezone(timezone);
  timezoneResolver.setSetting(timezone);
}
org.springframework.web.servletThemeResolversetThemeName

Javadoc

Set the current theme name to the given one.

Popular methods of ThemeResolver

  • resolveThemeName
    Resolve the current theme name via the given request. Should return a default theme as fallback in a

Popular in Java

  • Making http post requests using okhttp
  • onCreateOptionsMenu (Activity)
  • addToBackStack (FragmentTransaction)
  • setContentView (Activity)
  • Component (java.awt)
    A component is an object having a graphical representation that can be displayed on the screen and t
  • BufferedReader (java.io)
    Reads text from a character-input stream, buffering characters so as to provide for the efficient re
  • Dictionary (java.util)
    The Dictionary class is the abstract parent of any class, such as Hashtable, which maps keys to valu
  • ExecutorService (java.util.concurrent)
    An Executor that provides methods to manage termination and methods that can produce a Future for tr
  • ThreadPoolExecutor (java.util.concurrent)
    An ExecutorService that executes each submitted task using one of possibly several pooled threads, n
  • JTable (javax.swing)
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now