1 package org.apache.turbine.modules.layouts; 2 3 /* 4 * Licensed to the Apache Software Foundation (ASF) under one 5 * or more contributor license agreements. See the NOTICE file 6 * distributed with this work for additional information 7 * regarding copyright ownership. The ASF licenses this file 8 * to you under the Apache License, Version 2.0 (the 9 * "License"); you may not use this file except in compliance 10 * with the License. You may obtain a copy of the License at 11 * 12 * http://www.apache.org/licenses/LICENSE-2.0 13 * 14 * Unless required by applicable law or agreed to in writing, 15 * software distributed under the License is distributed on an 16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 * KIND, either express or implied. See the License for the 18 * specific language governing permissions and limitations 19 * under the License. 20 */ 21 22 import org.apache.turbine.modules.pages.DefaultPage; 23 import org.apache.turbine.pipeline.PipelineData; 24 import org.apache.turbine.util.RunData; 25 import org.apache.velocity.context.Context; 26 27 /** 28 * This Layout module is Turbine 2.3.3 VelocityDirectLayout (same package) 29 * with methods added for {@link PipelineData}. It is used in Jetspeed-1 portal. 30 * 31 * By using this layout any view write will immediately call the provided print writer {@link RunData#getOut()} and 32 * the HTTP servlet response will be flushed and set the committed flag. This means of course 33 * no change to the HTTP response header will be possible afterwards. By setting the {@link RunData#setAction(String)} in the request 34 * (not only the model, but also) additional response headers could be set, cft. {@link DefaultPage#doBuild(PipelineData)}. 35 * 36 * @author <a href="mailto:raphael@apache.org">Raphaƫl Luta</a> 37 * @author <a href="mailto:john.mcnally@clearink.com">John D. McNally</a> 38 * @author <a href="mailto:mbryson@mont.mindspring.com">Dave Bryson</a> 39 * @author <a href="mailto:hps@intermeta.de">Henning P. Schmiedehausen</a> 40 * @version $Id$ 41 */ 42 public class VelocityCachedLayout extends VelocityDirectLayout 43 { 44 /** 45 * Render layout 46 * 47 * @param pipelineData PipelineData 48 * @param context the Velocity context 49 * @param templateName relative path to Velocity template 50 * 51 * @throws Exception if rendering fails 52 */ 53 @Override 54 protected void render(PipelineData pipelineData, Context context, String templateName) 55 throws Exception 56 { 57 velocityService.handleRequest(context, 58 prefix + templateName, 59 pipelineData.getRunData().getOut()); 60 } 61 } 62