View Javadoc

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 org.apache.turbine.pipeline.PipelineData;
25  import org.apache.turbine.services.jsp.TurbineJsp;
26  import org.apache.turbine.util.RunData;
27  
28  /**
29   * Extends TemplatePage to add some convenience objects to the request.
30   *
31   * @author <a href="mailto:john.mcnally@clearink.com">John D. McNally</a>
32   * @author <a href="mailto:hps@intermeta.de">Henning P. Schmiedehausen</a>
33   * @author <a href="mailto:peter@courcoux.biz">Peter Courcoux</a>
34   * @version $Revision: 1078552 $
35   */
36  public class JspPage
37      extends TemplatePage
38  {
39      /**
40       * Stuffs some useful objects into the request so that
41       * it is available to the Action module and the Screen module
42       */
43      @Override
44      protected void doBuildBeforeAction(RunData data)
45          throws Exception
46      {
47          TurbineJsp.addDefaultObjects(data);
48  
49          try
50          {
51              //We try to set the buffer size from defaults
52              data.getResponse().setBufferSize(TurbineJsp.getDefaultBufferSize());
53          }
54          catch (IllegalStateException ise)
55          {
56              // If the response was already commited, we die silently
57              // No logger here?
58          }
59      }
60  
61      /**
62       * Stuffs some useful objects into the request so that
63       * it is available to the Action module and the Screen module
64       */
65      @Override
66      protected void doBuildBeforeAction(PipelineData pipelineData)
67          throws Exception
68      {
69          TurbineJsp.addDefaultObjects(pipelineData);
70  
71          try
72          {
73              RunData data = getRunData(pipelineData);
74              //We try to set the buffer size from defaults
75              data.getResponse().setBufferSize(TurbineJsp.getDefaultBufferSize());
76          }
77          catch (IllegalStateException ise)
78          {
79              // If the response was already commited, we die silently
80              // No logger here?
81          }
82      }
83  
84  }