001 package org.apache.turbine.modules.layouts; 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 024 import org.apache.turbine.modules.Layout; 025 import org.apache.turbine.pipeline.PipelineData; 026 import org.apache.turbine.util.RunData; 027 import org.apache.turbine.util.TurbineException; 028 029 /** 030 * This layout allows an action to manipulate the ServletOutputStream directly. 031 * It requires that data.declareDirectResponse() has been called to indicate 032 * that the OutputStream is being handled elsewhere. 033 * 034 * @author <a href="mailto:peter@courcoux.biz">Peter Courcoux</a> 035 * @version $Id: DirectResponseLayout.java 1066558 2011-02-02 18:12:40Z ludwig $ 036 */ 037 public class DirectResponseLayout extends Layout 038 { 039 /** 040 * Ensures that a direct response has been declared. 041 * 042 * @deprecated Use PipelineData version instead. 043 * @param data Turbine information. 044 * @exception TurbineException if a direct response has not been declared. 045 */ 046 @Deprecated 047 @Override 048 public void doBuild(RunData data) 049 throws Exception 050 { 051 if (!data.isOutSet()) 052 { 053 throw new TurbineException( 054 "data.declareDirectResponse() has not been called"); 055 } 056 } 057 058 /** 059 * Ensures that a direct response has been declared. 060 * 061 * @param data Turbine information. 062 * @exception TurbineException if a direct response has not been declared. 063 */ 064 @Override 065 public void doBuild(PipelineData pipelineData) 066 throws Exception 067 { 068 RunData data = getRunData(pipelineData); 069 doBuild(data); 070 } 071 072 073 }