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.TurbineConstants; 23 import org.apache.turbine.pipeline.PipelineData; 24 import org.apache.turbine.util.template.TemplateNavigation; 25 import org.apache.turbine.util.template.TemplateScreen; 26 import org.apache.velocity.context.Context; 27 28 /** 29 * This Layout module allows Velocity templates 30 * to be used as layouts. It will stream directly the output of 31 * the layout and navigation templates to the output writer without 32 * using a screen. Use this if you have a large page to output 33 * and won't buffer it in the memory. 34 * 35 * @author <a href="mailto:raphael@apache.org">Raphaƫl Luta</a> 36 * @author <a href="mailto:john.mcnally@clearink.com">John D. McNally</a> 37 * @author <a href="mailto:mbryson@mont.mindspring.com">Dave Bryson</a> 38 * @author <a href="mailto:hps@intermeta.de">Henning P. Schmiedehausen</a> 39 * @author <a href="mailto:peter@courcoux.biz">Peter Courcoux</a> 40 * @version $Id$ 41 */ 42 public class VelocityDirectLayout extends VelocityLayout 43 { 44 /** 45 * @see org.apache.turbine.modules.layouts.VelocityLayout#populateContext(org.apache.turbine.pipeline.PipelineData, org.apache.velocity.context.Context) 46 */ 47 @Override 48 protected void populateContext(PipelineData pipelineData, Context context) throws Exception 49 { 50 // variable for the screen in the layout template 51 context.put(TurbineConstants.SCREEN_PLACEHOLDER, 52 new TemplateScreen(pipelineData)); 53 54 // variable to reference the navigation screen in the layout template 55 context.put(TurbineConstants.NAVIGATION_PLACEHOLDER, 56 new TemplateNavigation(pipelineData)); 57 } 58 }