Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.mentawai.core
Class StreamConsequence  view StreamConsequence download StreamConsequence.java

java.lang.Object
  extended byorg.mentawai.core.StreamConsequence
All Implemented Interfaces:
Consequence

public class StreamConsequence
extends java.lang.Object
implements Consequence

A web-based consequence that gets a ready-to-use input stream from the output of the action, get the contents from that input stream and flush them to the servlet output stream. Very useful for loading images from a database, downloads and other resources that the programmer may want to protect from direct access from the client. This class is thread-safe.


Field Summary
private  java.lang.String content_disposition_key
           
static java.lang.String CONTENT_DISPOSITION_KEY
          The default key ("contentDisposition") to look for in the action output.
private  java.lang.String content_length_key
           
static java.lang.String CONTENT_LENGTH_KEY
          The default key ("contentLength") to look for in the action output.
private  java.lang.String contentType
           
private  java.lang.String stream_key
           
static java.lang.String STREAM_KEY
          The default key ("stream") to look for in the action output.
 
Constructor Summary
StreamConsequence(java.lang.String contentType)
          Creates a new instance of the StreamConsequence class, with the given content-type
StreamConsequence(java.lang.String contentType, java.lang.String stream_key)
          Creates a new instance of the StreamConsequence class, with the given content-type and key.
StreamConsequence(java.lang.String contentType, java.lang.String stream_key, java.lang.String content_disposition_key)
          Creates a new instance of the StreamConsequence class, with the given content-type and key.
StreamConsequence(java.lang.String contentType, java.lang.String stream_key, java.lang.String content_disposition_key, java.lang.String content_length_key)
          Creates a new instance of the StreamConsequence class, with the given content-type and key.
 
Method Summary
protected  void defineHeader(javax.servlet.http.HttpServletResponse res, Output output)
           
 void execute(Action a, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)
          Executes the action, reading from the input stream the data that has to be flushed into the servlet output stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STREAM_KEY

public static final java.lang.String STREAM_KEY
The default key ("stream") to look for in the action output.

See Also:
Constant Field Values

CONTENT_DISPOSITION_KEY

public static final java.lang.String CONTENT_DISPOSITION_KEY
The default key ("contentDisposition") to look for in the action output.

See Also:
Constant Field Values

CONTENT_LENGTH_KEY

public static final java.lang.String CONTENT_LENGTH_KEY
The default key ("contentLength") to look for in the action output.

See Also:
Constant Field Values

contentType

private java.lang.String contentType

stream_key

private java.lang.String stream_key

content_disposition_key

private java.lang.String content_disposition_key

content_length_key

private java.lang.String content_length_key
Constructor Detail

StreamConsequence

public StreamConsequence(java.lang.String contentType)
Creates a new instance of the StreamConsequence class, with the given content-type


StreamConsequence

public StreamConsequence(java.lang.String contentType,
                         java.lang.String stream_key)
Creates a new instance of the StreamConsequence class, with the given content-type and key.


StreamConsequence

public StreamConsequence(java.lang.String contentType,
                         java.lang.String stream_key,
                         java.lang.String content_disposition_key)
Creates a new instance of the StreamConsequence class, with the given content-type and key.


StreamConsequence

public StreamConsequence(java.lang.String contentType,
                         java.lang.String stream_key,
                         java.lang.String content_disposition_key,
                         java.lang.String content_length_key)
Creates a new instance of the StreamConsequence class, with the given content-type and key.

Method Detail

execute

public void execute(Action a,
                    javax.servlet.http.HttpServletRequest req,
                    javax.servlet.http.HttpServletResponse res)
             throws ConsequenceException
Executes the action, reading from the input stream the data that has to be flushed into the servlet output stream.

Specified by:
execute in interface Consequence

defineHeader

protected void defineHeader(javax.servlet.http.HttpServletResponse res,
                            Output output)