##### Coverage Report - org.apache.turbine.services.jsp.util.JspScreenPlaceholder

Classes in this File | Line Coverage | Branch Coverage | Complexity
JspScreenPlaceholder |
0% | 0/18
N/A | N/A
| 2.0;2

1 |  |
     package org.apache.turbine.services.jsp.util;
2 |  |
3 |  |
4 |  |
     /*
5 |  |
      * Licensed to the Apache Software Foundation (ASF) under one
6 |  |
      * or more contributor license agreements.  See the NOTICE file
7 |  |
      * distributed with this work for additional information
8 |  |
      * regarding copyright ownership.  The ASF licenses this file
9 |  |
      * to you under the Apache License, Version 2.0 (the
10 |  |
      * "License"); you may not use this file except in compliance
11 |  |
      * with the License.  You may obtain a copy of the License at
12 |  |
      *
13 |  |
      *   http://www.apache.org/licenses/LICENSE-2.0
14 |  |
      *
15 |  |
      * Unless required by applicable law or agreed to in writing,
16 |  |
      * software distributed under the License is distributed on an
17 |  |
      * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
18 |  |
      * KIND, either express or implied.  See the License for the
19 |  |
      * specific language governing permissions and limitations
20 |  |
      * under the License.
21 |  |
      */
22 |  |
23 |  |
24 |  |
     import org.apache.commons.logging.Log;
25 |  |
     import org.apache.commons.logging.LogFactory;
26 |  |
     import org.apache.turbine.modules.Screen;
27 |  |
     import org.apache.turbine.modules.ScreenLoader;
28 |  |
     import org.apache.turbine.services.assemblerbroker.TurbineAssemblerBroker;
29 |  |
     import org.apache.turbine.services.template.TurbineTemplate;
30 |  |
     import org.apache.turbine.util.RunData;
31 |  |
32 |  |
     /**
33 |  |
      * Returns output of a Screen module. An instance of this is placed in the
34 |  |
      * request by the JspLayout. This allows template authors to
35 |  |
      * place the screen template within the layout.<br>
36 |  |
      * Here's how it's used in a JSP template:<br>
37 |  |
      * <code>
38 |  |
      * <%useBean id="screen_placeholder" class="JspScreenPlaceholder" scope="request"/%>
39 |  |
      * ...
40 |  |
      * <%= screen_placeholder %>
41 |  |
      *</code>
42 |  |
      *
43 |  |
      * @author <a href="john.mcnally@clearink.com">John D. McNally</a>
44 |  |
      * @author <a href="mailto:hps@intermeta.de">Henning P. Schmiedehausen</a>
45 |  |
      * @version $Id: JspScreenPlaceholder.java 757213 2009-03-22 16:43:31Z tv $
46 |  |
      */
47 |  |
     public class JspScreenPlaceholder
48 |  |
     {
49 |  |
         /** Logging */
50 | 0 |
         private static Log log = LogFactory.getLog(JspNavigation.class);
51 |  |
52 |  |
         /* The RunData object */
53 |  |
         private RunData data;
54 |  |
55 |  |
         private ScreenLoader screenLoader;
56 |  |
57 |  |
         /**
58 |  |
          * Constructor
59 |  |
          *
60 |  |
          * @param data A Rundata Object
61 |  |
          */
62 |  |
         public JspScreenPlaceholder(RunData data)
63 | 0 |
         {
64 | 0 |
             this.data = data;
65 | 0 |
             this.screenLoader = (ScreenLoader)TurbineAssemblerBroker.getLoader(Screen.NAME);
66 | 0 |
         }
67 |  |
68 |  |
         /**
69 |  |
          * builds the output of the navigation template
70 |  |
          */
71 |  |
         public void exec()
72 |  |
         {
73 | 0 |
             String template = null;
74 | 0 |
             String module = null;
75 |  |
             try
76 |  |
             {
77 | 0 |
                 template = data.getTemplateInfo().getScreenTemplate();
78 | 0 |
                 module = TurbineTemplate.getScreenName(template);
79 | 0 |
                 screenLoader.exec(data, module);
80 |  |
             }
81 | 0 |
             catch (Exception e)
82 |  |
             {
83 | 0 |
                 String message = "Error processing navigation template:" +
84 |  |
                         template + " using module: " + module;
85 | 0 |
                 log.error(message, e);
86 |  |
                 try
87 |  |
                 {
88 | 0 |
                     data.getResponse().getWriter().print("Error processing navigation template: "
89 |  |
                             + template + " using module: " + module);
90 |  |
                 }
91 | 0 |
                 catch (java.io.IOException ioe)
92 |  |
                 {
93 |  |
                     // ignore
94 | 0 |
                 }
95 | 0 |
             }
96 | 0 |
         }
97 |  |
     }