    001package org.apache.turbine.modules.pages;
    002
    003
    004/*
    005 * Licensed to the Apache Software Foundation (ASF) under one
    006 * or more contributor license agreements.  See the NOTICE file
    007 * distributed with this work for additional information
    008 * regarding copyright ownership.  The ASF licenses this file
    009 * to you under the Apache License, Version 2.0 (the
    010 * "License"); you may not use this file except in compliance
    011 * with the License.  You may obtain a copy of the License at
    012 *
    013 *   http://www.apache.org/licenses/LICENSE-2.0
    014 *
    015 * Unless required by applicable law or agreed to in writing,
    016 * software distributed under the License is distributed on an
    017 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    018 * KIND, either express or implied.  See the License for the
    019 * specific language governing permissions and limitations
    020 * under the License.
    021 */
    022
    023
    024import javax.servlet.http.HttpServletResponse;
    025
    026import org.apache.turbine.Turbine;
    027import org.apache.turbine.annotation.TurbineService;
    028import org.apache.turbine.pipeline.PipelineData;
    029import org.apache.turbine.services.jsp.JspService;
    030
    031/**
    032 * Extends TemplatePage to add some convenience objects to the request.
    033 *
    034 * @author <a href="mailto:john.mcnally@clearink.com">John D. McNally</a>
    035 * @author <a href="mailto:hps@intermeta.de">Henning P. Schmiedehausen</a>
    036 * @author <a href="mailto:peter@courcoux.biz">Peter Courcoux</a>
    037 * @version $Revision: 1709648 $
    038 */
    039public class JspPage
    040    extends TemplatePage
    041{
    042    /** Injected service instance */
    043    @TurbineService
    044    private JspService jspService;
    045
    046    /**
    047     * Stuffs some useful objects into the request so that
    048     * it is available to the Action module and the Screen module
    049     */
    050    @Override
    051    protected void doBuildBeforeAction(PipelineData pipelineData)
    052        throws Exception
    053    {
    054        jspService.addDefaultObjects(pipelineData);
    055
    056        try
    057        {
    058            HttpServletResponse response = pipelineData.get(Turbine.class, HttpServletResponse.class);
    059            //We try to set the buffer size from defaults
    060            response.setBufferSize(jspService.getDefaultBufferSize());
    061        }
    062        catch (IllegalStateException ise)
    063        {
    064            // If the response was already committed, we die silently
    065            // No logger here?
    066        }
    067    }
    068
    069}