001package org.apache.turbine.modules.layouts; 002 003/* 004 * Licensed to the Apache Software Foundation (ASF) under one 005 * or more contributor license agreements. See the NOTICE file 006 * distributed with this work for additional information 007 * regarding copyright ownership. The ASF licenses this file 008 * to you under the Apache License, Version 2.0 (the 009 * "License"); you may not use this file except in compliance 010 * with the License. You may obtain a copy of the License at 011 * 012 * http://www.apache.org/licenses/LICENSE-2.0 013 * 014 * Unless required by applicable law or agreed to in writing, 015 * software distributed under the License is distributed on an 016 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 017 * KIND, either express or implied. See the License for the 018 * specific language governing permissions and limitations 019 * under the License. 020 */ 021 022import org.apache.turbine.modules.pages.DefaultPage; 023import org.apache.turbine.pipeline.PipelineData; 024import org.apache.turbine.util.RunData; 025import org.apache.velocity.context.Context; 026 027/** 028 * This Layout module is Turbine 2.3.3 VelocityDirectLayout (same package) 029 * with methods added for {@link PipelineData}. It is used in Jetspeed-1 portal. 030 * 031 * By using this layout any view write will immediately call the provided print writer {@link RunData#getOut()} and 032 * the HTTP servlet response will be flushed and set the committed flag. This means of course 033 * no change to the HTTP response header will be possible afterwards. By setting the {@link RunData#setAction(String)} in the request 034 * (not only the model, but also) additional response headers could be set, cft. {@link DefaultPage#doBuild(PipelineData)}. 035 * 036 * @author <a href="mailto:raphael@apache.org">Raphaƫl Luta</a> 037 * @author <a href="mailto:john.mcnally@clearink.com">John D. McNally</a> 038 * @author <a href="mailto:mbryson@mont.mindspring.com">Dave Bryson</a> 039 * @author <a href="mailto:hps@intermeta.de">Henning P. Schmiedehausen</a> 040 * @version $Id$ 041 */ 042public class VelocityCachedLayout extends VelocityDirectLayout 043{ 044 /** 045 * Render layout 046 * 047 * @param pipelineData PipelineData 048 * @param context the Velocity context 049 * @param templateName relative path to Velocity template 050 * 051 * @throws Exception if rendering fails 052 */ 053 @Override 054 protected void render(PipelineData pipelineData, Context context, String templateName) 055 throws Exception 056 { 057 velocityService.handleRequest(context, 058 prefix + templateName, 059 pipelineData.getRunData().getOut()); 060 } 061} 062