/** * Get template. * * @param name - template name * @return template instance * @throws IOException - If an I/O error occurs * @throws ParseException - If the template cannot be parsed * @see #getEngine() */ public Template getTemplate(String name) throws IOException, ParseException { return getTemplate(name, null, null, null); }
/** * Get template. * * @param name - template name * @param encoding - template encoding * @return template instance * @throws IOException - If an I/O error occurs * @throws ParseException - If the template cannot be parsed * @see #getEngine() */ public Template getTemplate(String name, String encoding, Object args) throws IOException, ParseException { return getTemplate(name, null, encoding, args); }
/** * Get template. * * @see #getEngine() * @param name - template name * @return template instance * @throws IOException - If an I/O error occurs * @throws ParseException - If the template cannot be parsed */ public Template getTemplate(String name) throws IOException, ParseException { return getTemplate(name, null, null, null); }
/** * Get template. * * @see #getEngine() * @param name - template name * @param locale - template locale * @return template instance * @throws IOException - If an I/O error occurs * @throws ParseException - If the template cannot be parsed */ public Template getTemplate(String name, Locale locale) throws IOException, ParseException { return getTemplate(name, locale, null, null); }
/** * Get template. * * @param name - template name * @param encoding - template encoding * @return template instance * @throws IOException - If an I/O error occurs * @throws ParseException - If the template cannot be parsed * @see #getEngine() */ public Template getTemplate(String name, String encoding) throws IOException, ParseException { return getTemplate(name, null, encoding, null); }
/** * Get template. * * @see #getEngine() * @param name - template name * @param locale - template locale * @param encoding - template encoding * @return template instance * @throws IOException - If an I/O error occurs * @throws ParseException - If the template cannot be parsed */ public Template getTemplate(String name, Locale locale, String encoding) throws IOException, ParseException { return getTemplate(name, locale, encoding, null); }
/** * Get template. * * @see #getEngine() * @param name - template name * @param encoding - template encoding * @return template instance * @throws IOException - If an I/O error occurs * @throws ParseException - If the template cannot be parsed */ public Template getTemplate(String name, String encoding) throws IOException, ParseException { return getTemplate(name, null, encoding, null); }
/** * Get template. * * @param name - template name * @param locale - template locale * @return template instance * @throws IOException - If an I/O error occurs * @throws ParseException - If the template cannot be parsed * @see #getEngine() */ public Template getTemplate(String name, Locale locale) throws IOException, ParseException { return getTemplate(name, locale, null, null); }
/** * Get template. * * @param name - template name * @param locale - template locale * @return template instance * @throws IOException - If an I/O error occurs * @throws ParseException - If the template cannot be parsed * @see #getEngine() */ public Template getTemplate(String name, Locale locale, Object args) throws IOException, ParseException { if (args instanceof String) return getTemplate(name, locale, (String) args); return getTemplate(name, locale, null, args); }
/** * Get template. * * @see #getEngine() * @param name - template name * @param encoding - template encoding * @return template instance * @throws IOException - If an I/O error occurs * @throws ParseException - If the template cannot be parsed */ public Template getTemplate(String name, String encoding, Object args) throws IOException, ParseException { return getTemplate(name, null, encoding, args); }
/** * Get template. * * @param name - template name * @param locale - template locale * @param encoding - template encoding * @return template instance * @throws IOException - If an I/O error occurs * @throws ParseException - If the template cannot be parsed * @see #getEngine() */ public Template getTemplate(String name, Locale locale, String encoding) throws IOException, ParseException { return getTemplate(name, locale, encoding, null); }
/** * Get template. * * @see #getEngine() * @param name - template name * @param locale - template locale * @return template instance * @throws IOException - If an I/O error occurs * @throws ParseException - If the template cannot be parsed */ public Template getTemplate(String name, Locale locale, Object args) throws IOException, ParseException { if (args instanceof String) return getTemplate(name, locale, (String) args); return getTemplate(name, locale, null, args); }
/** * inited. */ public void inited() { if (importMacros != null && importMacros.length > 0) { for (String importMacro : importMacros) { try { Template importMacroTemplate = engine.getTemplate(importMacro); importMacroTemplates.putAll(importMacroTemplate.getMacros()); } catch (Exception e) { throw new IllegalStateException(e.getMessage(), e); } } } }
/** * inited. */ public void inited() { if (importMacros != null && importMacros.length > 0) { for (String importMacro : importMacros) { try { Template importMacroTemplate = engine.getTemplate(importMacro); importMacroTemplates.putAll(importMacroTemplate.getMacros()); } catch (Exception e) { throw new IllegalStateException(e.getMessage(), e); } } } }
public void doFilter(HttpServletRequest request, HttpServletResponse response, FilterChain chain) throws IOException, ServletException { chain.doFilter(request, response); try { WebEngine.setRequestAndResponse(request, response); WebEngine.getEngine().getTemplate(getTemplatePath(request), request.getLocale()).render(response); } catch (ParseException e) { throw new ServletException(e.getMessage(), e); } }
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { try { WebEngine.setRequestAndResponse(request, response); WebEngine.getEngine().getTemplate(getTemplatePath(request), request.getLocale()).render(response); } catch (ParseException e) { throw new ServletException(e.getMessage(), e); } }
@Override public void render() { try { WebEngine.setRequestAndResponse(request, response); WebEngine.getEngine().getTemplate(this.view, request.getLocale()).render(response); } catch (Exception e) { throw new RenderException(e.getMessage(), e); } }
@Override protected void renderMergedTemplateModel(Map<String, Object> model, HttpServletRequest request, HttpServletResponse response) throws Exception { WebEngine.setRequestAndResponse(request, response); WebEngine.getEngine().getTemplate(getUrl(), request.getLocale(), model).render(model, response); }
public void render(HttpServletRequest req, HttpServletResponse resp, Object obj) throws Throwable { String path = getTemplatePath(evalPath(req, obj), req); WebEngine.setRequestAndResponse(req, resp); WebEngine.getEngine().getTemplate(path, req.getLocale(), obj).render(obj, resp); }
@Override protected void doExecute(String location, ActionInvocation invocation) throws Exception { ValueStack stack = ActionContext.getContext().getValueStack(); ValueStackMap map = new ValueStackMap(stack); HttpServletRequest request = ServletActionContext.getRequest(); HttpServletResponse response = ServletActionContext.getResponse(); WebEngine.setRequestAndResponse(request, response); WebEngine.getEngine().getTemplate(location, request.getLocale(), map).render(map, response); }