Package cambridge.springwebmvc

Source Code of cambridge.springwebmvc.CambridgeTemplateView

package cambridge.springwebmvc;

import cambridge.Template;
import cambridge.TemplateFactory;
import org.springframework.web.servlet.support.RequestContextUtils;
import org.springframework.web.servlet.view.AbstractTemplateView;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Locale;
import java.util.Map;

/**
* @author Erdinc YILMAZEL
* @since 1/29/11
*/
public class CambridgeTemplateView extends AbstractTemplateView {
   TemplateFactory templateFactory;

   @Override
   protected void renderMergedTemplateModel(Map<String, Object> model, HttpServletRequest request, HttpServletResponse response) throws Exception {
      exposeModelAsRequestAttributes(model, request);

      if (logger.isDebugEnabled()) {
         logger.debug("Rendering Cambridge template [" + getUrl() + "] in CambridgeTemplateView '" + getBeanName() + "'");
      }

      // Grab the locale-specific version of the template.
      Locale locale = RequestContextUtils.getLocale(request);

      Template template = templateFactory.createTemplate(locale);
      template.printTo(response.getWriter());
   }
}
TOP

Related Classes of cambridge.springwebmvc.CambridgeTemplateView

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.