Exemplo n.º 1
0
 public void doFilter(HttpServletRequest request, HttpServletResponse response, FilterChain chain)
     throws IOException, ServletException {
   chain.doFilter(request, response);
   try {
     Context context = Context.getContext();
     context.put("request", request);
     context.put("response", response);
     WebEngine.getEngine()
         .getTemplate(getTemplatePath(request), request.getLocale())
         .render(response);
   } catch (ParseException e) {
     throw new ServletException(e.getMessage(), e);
   }
 }
Exemplo n.º 2
0
 private Locale getLocale() {
   Template template = Context.getContext().getTemplate();
   if (template != null && template.getLocale() != null) {
     return template.getLocale();
   }
   Object locale = resolver.get("locale");
   if (locale instanceof Locale) {
     return (Locale) locale;
   }
   if (locale instanceof String) {
     return LocaleUtils.getLocale((String) locale);
   }
   return null;
 }
Exemplo n.º 3
0
 @Override
 public String toString() {
   return render(Context.getContext().getParameters());
 }