View Javadoc

    1   package org.apache.turbine.modules.layouts;
    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.modules.Layout;
    25  import org.apache.turbine.pipeline.PipelineData;
    26  import org.apache.turbine.util.RunData;
    27  import org.apache.turbine.util.TurbineException;
    28
    29  /**
    30   * This layout allows an action to manipulate the ServletOutputStream directly.
    31   * It requires that data.declareDirectResponse() has been called to indicate
    32   * that the OutputStream is being handled elsewhere.
    33   *
    34   * @author <a href="mailto:peter@courcoux.biz">Peter Courcoux</a>
    35   * @version $Id: DirectResponseLayout.java 1066558 2011-02-02 18:12:40Z ludwig $
    36   */
    37  public class DirectResponseLayout extends Layout
    38  {
    39      /**
    40       * Ensures that a direct response has been declared.
    41       *
    42       * @deprecated Use PipelineData version instead.
    43       * @param data Turbine information.
    44       * @exception TurbineException if a direct response has not been declared.
    45       */
    46      @Deprecated
    47      @Override
    48      public void doBuild(RunData data)
    49          throws Exception
    50      {
    51          if (!data.isOutSet())
    52          {
    53              throw new TurbineException(
    54                  "data.declareDirectResponse() has not been called");
    55          }
    56      }
    57
    58      /**
    59       * Ensures that a direct response has been declared.
    60       *
    61       * @param data Turbine information.
    62       * @exception TurbineException if a direct response has not been declared.
    63       */
    64      @Override
    65      public void doBuild(PipelineData pipelineData)
    66      throws Exception
    67      {
    68          RunData data = getRunData(pipelineData);
    69          doBuild(data);
    70      }
    71
    72
    73  }