1/*2 * Copyright 2000-2001,2004 The Apache Software Foundation.3 * 4 * Licensed under the Apache License, Version 2.0 (the "License");5 * you may not use this file except in compliance with the License.6 * You may obtain a copy of the License at7 * 8 * http://www.apache.org/licenses/LICENSE-2.09 * 10 * Unless required by applicable law or agreed to in writing, software11 * distributed under the License is distributed on an "AS IS" BASIS,12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.13 * See the License for the specific language governing permissions and14 * limitations under the License.15 */1617packageorg.apache.jetspeed.modules.pages;
1819import org.apache.turbine.util.RunData;
20import org.apache.turbine.services.velocity.TurbineVelocity;
21import org.apache.turbine.services.velocity.VelocityService;
22import org.apache.velocity.context.Context;
23import org.apache.jetspeed.util.template.JetspeedTemplateNavigation;
2425/***26 * Extends JetspeedTemplatePage to set the Velocity template Context.27 *28 * @author <a href="mailto:raphael@apache.org">Raphaël Luta</a>29 * @version $Id: JetspeedVelocityPage.java,v 1.9 2004/02/23 02:59:52 jford Exp $30 */31publicclassJetspeedVelocityPageextendsJetspeedTemplatePage32 {
33/***34 * Stuffs the Context into the RunData so that it is available to35 * the Action module and the Screen module via getContext().36 *37 * Add a couple of default jetspeed context objects.38 *39 * @param data Turbine information.40 * @exception Exception, a generic exception.41 */42protectedvoid doBuildBeforeAction(RunData data) throws Exception
43 {
44super.doBuildBeforeAction(data);
4546 Context context = TurbineVelocity.getContext(data);
4748 context.put("jnavigation", newJetspeedTemplateNavigation(data));
49 data.getTemplateInfo().setTemplateContext(VelocityService.CONTEXT, context);
50 }
5152/***53 * Allows the VelocityService to peform post-request actions.54 * (releases the (non-global) tools in the context for reuse later)55 */56protectedvoid doPostBuild(RunData data) throws Exception
57 {
58 Context context = TurbineVelocity.getContext(data);
59 TurbineVelocity.requestFinished(context);
60 }
6162 }