Save This Page
Home » tapestry-src-5.0.19 » org.apache.tapestry5 » [javadoc | source]
    1   // Copyright 2007, 2008 The Apache Software Foundation
    2   //
    3   // Licensed under the Apache License, Version 2.0 (the "License");
    4   // you may not use this file except in compliance with the License.
    5   // You may obtain a copy of the License at
    6   //
    7   //     http://www.apache.org/licenses/LICENSE-2.0
    8   //
    9   // Unless required by applicable law or agreed to in writing, software
   10   // distributed under the License is distributed on an "AS IS" BASIS,
   11   // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   12   // See the License for the specific language governing permissions and
   13   // limitations under the License.
   14   
   15   package org.apache.tapestry5;
   16   
   17   import org.apache.tapestry5.services.Response;
   18   
   19   import java.io.BufferedInputStream;
   20   import java.io.IOException;
   21   import java.io.InputStream;
   22   
   23   /**
   24    * An alternate response from a component event handler method used to directly provide a stream of data to be sent to
   25    * the client, rather than indicating what page to send a render redirect request to.
   26    */
   27   public interface StreamResponse
   28   {
   29       /**
   30        * Returns the content type to be reported to the client.
   31        */
   32       String getContentType();
   33   
   34       /**
   35        * Returns the stream of bytes to be sent to the client. The stream will be closed when the end of the stream is
   36        * reached. The provided stream will be wrapped in a {@link BufferedInputStream} for efficiency.
   37        */
   38       InputStream getStream() throws IOException;
   39   
   40   
   41       /**
   42        * Prepares the response before it is sent to the client. This is the place to set any response headers (e.g.
   43        * content-disposition).
   44        *
   45        * @param response Response that will be sent.
   46        */
   47       void prepareResponse(Response response);
   48   
   49   }

Save This Page
Home » tapestry-src-5.0.19 » org.apache.tapestry5 » [javadoc | source]