##### Coverage Report - org.apache.turbine.modules.navigations.BaseJspNavigation

Classes in this File | Line Coverage | Branch Coverage | Complexity
BaseJspNavigation |
0% | 0/7
N/A | N/A
| 1.0;1

1 |  |
     package org.apache.turbine.modules.navigations;
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.turbine.annotation.TurbineService;
25 |  |
     import org.apache.turbine.modules.Navigation;
26 |  |
     import org.apache.turbine.pipeline.PipelineData;
27 |  |
     import org.apache.turbine.services.jsp.JspService;
28 |  |
     import org.apache.turbine.util.RunData;
29 |  |
30 |  |
     /**
31 |  |
      * Base JSP navigation that should be subclassed by Navigation that want to
32 |  |
      * use JSP.  Subclasses should override the doBuildTemplate() method.
33 |  |
      *
34 |  |
      * @author <a href="mailto:john.mcnally@clearink.com">John D. McNally</a>
35 |  |
      * @author <a href="mailto:hps@intermeta.de">Henning P. Schmiedehausen</a>
36 |  |
      * @author <a href="mailto:peter@courcoux.biz">Peter Courcoux</a>
37 |  |
      * @version $Id: BaseJspNavigation.java 1709648 2015-10-20 17:08:10Z tv $
38 |  |
      */
39 | 0 |
     public class BaseJspNavigation
40 |  |
             extends TemplateNavigation
41 |  |
     {
42 |  |
         /** The prefix for lookup up navigation pages */
43 | 0 |
         private final String prefix = Navigation.PREFIX + "/";
44 |  |
45 |  |
         /** Injected service instance */
46 |  |
         @TurbineService
47 |  |
         private JspService jspService;
48 |  |
49 |  |
         /**
50 |  |
          * Method to be overridden by subclasses to include data in beans, etc.
51 |  |
          *
52 |  |
          * @param pipelineData the PipelineData object
53 |  |
          * @throws Exception a generic exception.
54 |  |
          */
55 |  |
         @Override
56 |  |
         protected void doBuildTemplate(PipelineData pipelineData)
57 |  |
             throws Exception
58 |  |
         {
59 |  |
             // empty
60 | 0 |
         }
61 |  |
62 |  |
         /**
63 |  |
          * Method that sets up beans and forward the request to the JSP.
64 |  |
          *
65 |  |
          * @param pipelineData the PipelineData object
66 |  |
          * @return null - the JSP sends the information
67 |  |
          * @throws Exception a generic exception.
68 |  |
          */
69 |  |
         @Override
70 |  |
         public String buildTemplate(PipelineData pipelineData)
71 |  |
             throws Exception
72 |  |
         {
73 | 0 |
             RunData data = getRunData(pipelineData);
74 |  |
             // get the name of the JSP we want to use
75 | 0 |
             String templateName = data.getTemplateInfo().getNavigationTemplate();
76 |  |
77 |  |
             // navigations are used by a layout
78 | 0 |
             jspService.handleRequest(pipelineData, prefix + templateName);
79 | 0 |
             return null;
80 |  |
         }
81 |  |
     }