| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| BaseJspNavigation |
|
| 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.ecs.ConcreteElement; | |
| 25 | import org.apache.turbine.modules.Navigation; | |
| 26 | import org.apache.turbine.pipeline.PipelineData; | |
| 27 | import org.apache.turbine.services.jsp.TurbineJsp; | |
| 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 1078552 2011-03-06 19:58:46Z 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 | /** | |
| 46 | * Method to be overidden by subclasses to include data in beans, etc. | |
| 47 | * @deprecated Use PipelineData version instead. | |
| 48 | * @param data the Rundata object | |
| 49 | * @throws Exception a generic exception. | |
| 50 | */ | |
| 51 | @Deprecated | |
| 52 | @Override | |
| 53 | protected void doBuildTemplate(RunData data) | |
| 54 | throws Exception | |
| 55 | { | |
| 56 | // empty | |
| 57 | 0 | } |
| 58 | ||
| 59 | /** | |
| 60 | * Method to be overidden by subclasses to include data in beans, etc. | |
| 61 | * | |
| 62 | * @param data the PipelineData object | |
| 63 | * @throws Exception a generic exception. | |
| 64 | */ | |
| 65 | @Override | |
| 66 | protected void doBuildTemplate(PipelineData pipelineData) | |
| 67 | throws Exception | |
| 68 | { | |
| 69 | // empty | |
| 70 | 0 | } |
| 71 | ||
| 72 | ||
| 73 | ||
| 74 | /** | |
| 75 | * Method that sets up beans and forward the request to the JSP. | |
| 76 | * | |
| 77 | * @deprecated Use PipelineData version instead. | |
| 78 | * @param data the Rundata object | |
| 79 | * @return null - the JSP sends the information | |
| 80 | * @throws Exception a generic exception. | |
| 81 | */ | |
| 82 | @Deprecated | |
| 83 | @Override | |
| 84 | public ConcreteElement buildTemplate(RunData data) | |
| 85 | throws Exception | |
| 86 | { | |
| 87 | // get the name of the JSP we want to use | |
| 88 | 0 | String templateName = data.getTemplateInfo().getNavigationTemplate(); |
| 89 | ||
| 90 | // navigations are used by a layout | |
| 91 | 0 | TurbineJsp.handleRequest(data, prefix + templateName); |
| 92 | 0 | return null; |
| 93 | } | |
| 94 | ||
| 95 | /** | |
| 96 | * Method that sets up beans and forward the request to the JSP. | |
| 97 | * | |
| 98 | * @param data the PipelineData object | |
| 99 | * @return null - the JSP sends the information | |
| 100 | * @throws Exception a generic exception. | |
| 101 | */ | |
| 102 | @Override | |
| 103 | public ConcreteElement buildTemplate(PipelineData pipelineData) | |
| 104 | throws Exception | |
| 105 | { | |
| 106 | 0 | RunData data = getRunData(pipelineData); |
| 107 | // get the name of the JSP we want to use | |
| 108 | 0 | String templateName = data.getTemplateInfo().getNavigationTemplate(); |
| 109 | ||
| 110 | // navigations are used by a layout | |
| 111 | 0 | TurbineJsp.handleRequest(pipelineData, prefix + templateName); |
| 112 | 0 | return null; |
| 113 | } | |
| 114 | ||
| 115 | ||
| 116 | } |