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 1706239 2015-10-01 13:18:35Z tv $
    36   */
    37  public class DirectResponseLayout extends Layout
    38  {
    39      /**
    40       * Ensures that a direct response has been declared.
    41       *
    42       * @param pipelineData Turbine information.
    43       * @exception TurbineException if a direct response has not been declared.
    44       */
    45      @Override
    46      public void doBuild(PipelineData pipelineData)
    47      throws Exception
    48      {
    49          RunData data = getRunData(pipelineData);
    50          if (!data.isOutSet())
    51          {
    52              throw new TurbineException(
    53                  "data.declareDirectResponse() has not been called");
    54          }
    55      }
    56  }