001 package com.khubla.pragmatach.plugin.thymeleaf; 002 003 import org.thymeleaf.templateresolver.ITemplateResolver; 004 005 import com.khubla.pragmatach.framework.api.PragmatachException; 006 import com.khubla.pragmatach.framework.api.Response; 007 import com.khubla.pragmatach.framework.controller.impl.FormPostBeanBoundController; 008 009 /** 010 * @author tome 011 */ 012 public class ThymeleafController extends FormPostBeanBoundController { 013 /** 014 * ctor 015 */ 016 public ThymeleafController() { 017 } 018 019 /** 020 * render 021 */ 022 public Response render() throws PragmatachException { 023 try { 024 final ITemplateResolver templateResolver = new PragmatachTemplateResolver(getRequest().getServletContext()); 025 return new ThymeleafResponse(getCacheHeaders(), getTemplateName(), getTemplateContext(), templateResolver); 026 } catch (final Exception e) { 027 throw new PragmatachException("Exception in render", e); 028 } 029 } 030 }