%line | %branch | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
org.apache.turbine.modules.layouts.JspLayout |
|
|
1 | package org.apache.turbine.modules.layouts; |
|
2 | ||
3 | /* |
|
4 | * Copyright 2001-2005 The Apache Software Foundation. |
|
5 | * |
|
6 | * Licensed under the Apache License, Version 2.0 (the "License") |
|
7 | * you may not use this file except in compliance with the License. |
|
8 | * You may obtain a copy of the License at |
|
9 | * |
|
10 | * http://www.apache.org/licenses/LICENSE-2.0 |
|
11 | * |
|
12 | * Unless required by applicable law or agreed to in writing, software |
|
13 | * distributed under the License is distributed on an "AS IS" BASIS, |
|
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
15 | * See the License for the specific language governing permissions and |
|
16 | * limitations under the License. |
|
17 | */ |
|
18 | ||
19 | import org.apache.turbine.TurbineConstants; |
|
20 | import org.apache.turbine.modules.Layout; |
|
21 | import org.apache.turbine.services.jsp.TurbineJsp; |
|
22 | import org.apache.turbine.services.jsp.util.JspNavigation; |
|
23 | import org.apache.turbine.services.jsp.util.JspScreenPlaceholder; |
|
24 | import org.apache.turbine.util.RunData; |
|
25 | ||
26 | /** |
|
27 | * This Layout module allows JSP templates to be used as layouts. Since |
|
28 | * dynamic content is supposed to be primarily located in screens and |
|
29 | * navigations there should be relatively few reasons to subclass this Layout. |
|
30 | * |
|
31 | * @author <a href="mailto:john.mcnally@clearink.com">John D. McNally</a> |
|
32 | * @author <a href="mailto:hps@intermeta.de">Henning P. Schmiedehausen</a> |
|
33 | * @version $Id: JspLayout.java 264148 2005-08-29 14:21:04Z henning $ |
|
34 | */ |
|
35 | 0 | public class JspLayout |
36 | extends Layout |
|
37 | { |
|
38 | /** The prefix for lookup up layout pages */ |
|
39 | 0 | private String prefix = TurbineConstants.LAYOUT_PREFIX + "/"; |
40 | ||
41 | /** |
|
42 | * Method called by LayoutLoader. |
|
43 | * |
|
44 | * @param data RunData |
|
45 | * @throws Exception generic exception |
|
46 | */ |
|
47 | public void doBuild(RunData data) |
|
48 | throws Exception |
|
49 | { |
|
50 | 0 | data.getResponse().setContentType("text/html"); |
51 | 0 | data.declareDirectResponse(); |
52 | ||
53 | // variable to reference the screen in the layout template |
|
54 | 0 | data.getRequest() |
55 | .setAttribute(TurbineConstants.SCREEN_PLACEHOLDER, |
|
56 | new JspScreenPlaceholder(data)); |
|
57 | ||
58 | // variable to reference the navigations in the layout template |
|
59 | 0 | data.getRequest().setAttribute( |
60 | TurbineConstants.NAVIGATION_PLACEHOLDER, |
|
61 | new JspNavigation(data)); |
|
62 | ||
63 | // Grab the layout template set in the TemplatePage. |
|
64 | 0 | String templateName = data.getTemplateInfo().getLayoutTemplate(); |
65 | ||
66 | 0 | TurbineJsp.handleRequest(data, prefix + templateName, true); |
67 | 0 | } |
68 | } |
This report is generated by jcoverage, Maven and Maven JCoverage Plugin. |