1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.jetspeed.modules.pages;
18
19 import org.apache.turbine.util.RunData;
20 import org.apache.turbine.services.velocity.TurbineVelocity;
21 import org.apache.turbine.services.velocity.VelocityService;
22 import org.apache.velocity.context.Context;
23 import org.apache.jetspeed.util.template.JetspeedTemplateNavigation;
24
25 /***
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 */
31 public class JetspeedVelocityPage extends JetspeedTemplatePage
32 {
33 /***
34 * Stuffs the Context into the RunData so that it is available to
35 * 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 */
42 protected void doBuildBeforeAction(RunData data) throws Exception
43 {
44 super.doBuildBeforeAction(data);
45
46 Context context = TurbineVelocity.getContext(data);
47
48 context.put("jnavigation", new JetspeedTemplateNavigation(data));
49 data.getTemplateInfo().setTemplateContext(VelocityService.CONTEXT, context);
50 }
51
52 /***
53 * Allows the VelocityService to peform post-request actions.
54 * (releases the (non-global) tools in the context for reuse later)
55 */
56 protected void doPostBuild(RunData data) throws Exception
57 {
58 Context context = TurbineVelocity.getContext(data);
59 TurbineVelocity.requestFinished(context);
60 }
61
62 }