1 package org.apache.turbine.modules.pages; 2 3 4 /* 5 * Licensed to the Apache Software Foundation (ASF) under one 6 * or more contributor license agreements. See the NOTICE file 7 * distributed with this work for additional information 8 * regarding copyright ownership. The ASF licenses this file 9 * to you under the Apache License, Version 2.0 (the 10 * "License"); you may not use this file except in compliance 11 * with the License. You may obtain a copy of the License at 12 * 13 * http://www.apache.org/licenses/LICENSE-2.0 14 * 15 * Unless required by applicable law or agreed to in writing, 16 * software distributed under the License is distributed on an 17 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 18 * KIND, either express or implied. See the License for the 19 * specific language governing permissions and limitations 20 * under the License. 21 */ 22 23 24 import javax.servlet.http.HttpServletResponse; 25 26 import org.apache.turbine.Turbine; 27 import org.apache.turbine.annotation.TurbineService; 28 import org.apache.turbine.pipeline.PipelineData; 29 import org.apache.turbine.services.jsp.JspService; 30 31 /** 32 * Extends TemplatePage to add some convenience objects to the request. 33 * 34 * @author <a href="mailto:john.mcnally@clearink.com">John D. McNally</a> 35 * @author <a href="mailto:hps@intermeta.de">Henning P. Schmiedehausen</a> 36 * @author <a href="mailto:peter@courcoux.biz">Peter Courcoux</a> 37 * @version $Revision$ 38 */ 39 public class JspPage 40 extends TemplatePage 41 { 42 /** Injected service instance */ 43 @TurbineService 44 private JspService jspService; 45 46 /** 47 * Stuffs some useful objects into the request so that 48 * it is available to the Action module and the Screen module 49 */ 50 @Override 51 protected void doBuildBeforeAction(PipelineData pipelineData) 52 throws Exception 53 { 54 jspService.addDefaultObjects(pipelineData); 55 56 try 57 { 58 HttpServletResponse response = pipelineData.get(Turbine.class, HttpServletResponse.class); 59 //We try to set the buffer size from defaults 60 response.setBufferSize(jspService.getDefaultBufferSize()); 61 } 62 catch (IllegalStateException ise) 63 { 64 // If the response was already committed, we die silently 65 // No logger here? 66 } 67 } 68 69 }