1 16 package org.apache.jetspeed.modules.layouts; 17 18 import org.apache.jetspeed.services.TemplateLocator; 20 import org.apache.jetspeed.services.logging.JetspeedLogFactoryService; 21 import org.apache.jetspeed.services.logging.JetspeedLogger; 22 23 import org.apache.turbine.modules.Layout; 25 import org.apache.turbine.util.RunData; 26 import org.apache.turbine.services.TurbineServices; 27 import org.apache.turbine.services.jsp.JspService; 28 import org.apache.turbine.services.jsp.TurbineJspService; 29 30 42 public class JetspeedJspLayout extends Layout 43 { 44 47 private static final JetspeedLogger logger = JetspeedLogFactoryService.getLogger(JetspeedJspLayout.class.getName()); 48 49 54 public void doBuild(RunData data) throws Exception 55 { 56 String screenPath = null; 57 58 62 TurbineJspService jsp = (TurbineJspService)TurbineServices.getInstance().getService(JspService.SERVICE_NAME); 63 64 data.getResponse().setContentType(data.getContentType()); 66 if (logger.isInfoEnabled() ) 67 { 68 logger.info("JetspeedJspLayout: set response content type to " + data.getContentType()); 69 } 70 71 data.declareDirectResponse(); 73 74 String path = TemplateLocator.locateScreenTemplate(data, data.getScreenTemplate()); 76 if (path != null) 77 screenPath = jsp.getRelativeTemplateName("/screens" + path); 78 data.getRequest().setAttribute("screenJsp", screenPath); 79 if (logger.isInfoEnabled() ) 80 { 81 logger.info("JetspeedJspLayout: set 'screenJSP' to: " + screenPath ); 82 } 83 84 String templateName = data.getLayoutTemplate(); 86 87 if (logger.isInfoEnabled() ) 89 { 90 logger.info("JetspeedJspLayout: forward request to: " + "/layouts" + templateName); 91 } 92 jsp.handleRequest(data, "/layouts" + templateName, false); 93 } 94 95 } 96 | Popular Tags |