1 package org.apache.turbine.modules.layouts; 2 3 18 19 import org.apache.commons.logging.Log; 20 import org.apache.commons.logging.LogFactory; 21 22 import org.apache.turbine.TurbineConstants; 23 import org.apache.turbine.modules.Layout; 24 import org.apache.turbine.services.velocity.TurbineVelocity; 25 import org.apache.turbine.util.RunData; 26 import org.apache.turbine.util.template.TemplateNavigation; 27 import org.apache.turbine.util.template.TemplateScreen; 28 29 import org.apache.velocity.context.Context; 30 31 44 public class VelocityDirectLayout 45 extends Layout 46 { 47 48 private static Log log = LogFactory.getLog(VelocityDirectLayout.class); 49 50 51 private String prefix = TurbineConstants.LAYOUT_PREFIX + "/"; 52 53 59 public void doBuild(RunData data) 60 throws Exception 61 { 62 Context context = TurbineVelocity.getContext(data); 64 65 context.put(TurbineConstants.SCREEN_PLACEHOLDER, 67 new TemplateScreen(data)); 68 69 context.put(TurbineConstants.NAVIGATION_PLACEHOLDER, 71 new TemplateNavigation(data)); 72 73 String templateName = data.getTemplateInfo().getLayoutTemplate(); 77 78 data.getResponse().setLocale(data.getLocale()); 80 data.getResponse().setContentType(data.getContentType()); 81 82 log.debug("Now trying to render layout " + templateName); 83 84 TurbineVelocity.handleRequest(context, 86 prefix + templateName, data.getOut()); 87 } 88 } 89 | Popular Tags |