1 avoid load resource when get not expired content 2 multi resource in one request
252627282930313233
this.res = res; } public TextModel getText() { if (null == text) { text = new TextModel(stack, req, res); } return text; }
4950515253545556
} return false; } protected void mergeTemplate(Writer writer) throws Exception { TemplateEngine engine = getContainer().getInstance(TemplateEngine.class); engine.render(getTheme().getTemplatePath(getClass(), engine.getSuffix()), stack, writer, this); }
5051525354555657
525354555657585960
final public boolean usesBody() { return true; } public final void setTheme(String newTheme) { this.theme = new Theme(newTheme); pushTheme(theme); useNewTheme = true; }
92939495969798
return theme; } } public void setTheme(String theme) { this.theme = new Theme(theme); }
464748495051525354
final public boolean usesBody() { return true; } public void setTheme(String newTheme) { this.theme = new Theme(newTheme); this.innerTheme = this.theme; stack.getContext().put(Theme.INNER_THEME, innerTheme); }
90919293949596
585960616263646566676869
pushTheme(theme); useNewTheme = true; } private void pushTheme(Theme theme) { ThemeStack themestack = (ThemeStack) stack.getContext().get(Theme.THEME_STACK); if (null == themestack) { themestack = new ThemeStack(); stack.getContext().put(Theme.THEME_STACK, themestack); } themestack.push(theme); }
676869707172737475
} themestack.push(theme); } private void popTheme() { ThemeStack themestack = (ThemeStack) stack.getContext().get(Theme.THEME_STACK); themestack.pop(); if (themestack.isEmpty()) stack.getContext().remove(Theme.THEME_STACK); }
78798081828384858687888990
this.id = id; } protected Theme getTheme() { if (null == theme) { ThemeStack themestack = (ThemeStack) stack.getContext().get(Theme.THEME_STACK); if (null != themestack) { theme = themestack.peek(); } if (null == theme) { theme = (Theme) stack.getContext().get(Theme.THEME); } return theme;