/** * Return the current theme (never {@code null}). * <p>Resolved lazily for more efficiency when theme support is not being used. */ public Theme getTheme() { if (this.theme == null) { // Lazily determine theme to use for this RequestContext. this.theme = RequestContextUtils.getTheme(this.request); if (this.theme == null) { // No ThemeResolver and ThemeSource available -> try fallback. this.theme = getFallbackTheme(); } } return this.theme; }
/** * Return the current theme (never {@code null}). * <p>Resolved lazily for more efficiency when theme support is not being used. */ public Theme getTheme() { if (this.theme == null) { // Lazily determine theme to use for this RequestContext. this.theme = RequestContextUtils.getTheme(this.request); if (this.theme == null) { // No ThemeResolver and ThemeSource available -> try fallback. this.theme = getFallbackTheme(); } } return this.theme; }
private String getThemeName(HttpServletRequest request) { Theme theme = getTheme(request); if (theme == null) return null; return theme.getName(); }
/** * Return the current theme (never {@code null}). * <p>Resolved lazily for more efficiency when theme support is not being used. */ public Theme getTheme() { if (this.theme == null) { // Lazily determine theme to use for this RequestContext. this.theme = RequestContextUtils.getTheme(this.request); if (this.theme == null) { // No ThemeResolver and ThemeSource available -> try fallback. this.theme = getFallbackTheme(); } } return this.theme; }
@Override public String resolve(String asset) throws AssetResolveException { if (prefix == null) prefix = "/"; if (!(viewResolver instanceof JtwigViewResolver)) throw new AssetResolveException("The view resolver must be a JtwigViewResolver"); else { if (((JtwigViewResolver) viewResolver).useThemeInViewPath()) { Theme theme = getTheme(LocalThreadHolder.getServletRequest()); if (theme != null) { return path(prefix).append(theme.getName()).append(asset).toString(); } } } return path(prefix).append(asset).toString(); }