1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.apache.jetspeed.modules.layouts;
17
18
19 import org.apache.jetspeed.services.TemplateLocator;
20 import org.apache.jetspeed.services.logging.JetspeedLogFactoryService;
21 import org.apache.jetspeed.services.logging.JetspeedLogger;
22
23
24 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
31
32
33
34
35
36
37
38
39
40
41
42 public class JetspeedJspLayout extends Layout
43 {
44 /***
45 * Static initialization of the logger for this class
46 */
47 private static final JetspeedLogger logger = JetspeedLogFactoryService.getLogger(JetspeedJspLayout.class.getName());
48
49 /***
50 * Method called by LayoutLoader.
51 *
52 * @param RunData
53 */
54 public void doBuild(RunData data) throws Exception
55 {
56 String screenPath = null;
57
58
59
60
61
62 TurbineJspService jsp = (TurbineJspService)TurbineServices.getInstance().getService(JspService.SERVICE_NAME);
63
64
65 data.getResponse().setContentType(data.getContentType());
66 if (logger.isInfoEnabled() )
67 {
68 logger.info("JetspeedJspLayout: set response content type to " + data.getContentType());
69 }
70
71
72 data.declareDirectResponse();
73
74
75 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
85 String templateName = data.getLayoutTemplate();
86
87
88 if (logger.isInfoEnabled() )
89 {
90 logger.info("JetspeedJspLayout: forward request to: " + "/layouts" + templateName);
91 }
92 jsp.handleRequest(data, "/layouts" + templateName, false);
93 }
94
95 }