com.opensymphony.webwork.dispatcher
Class StreamResult

java.lang.Object
  extended bycom.opensymphony.webwork.dispatcher.WebWorkResultSupport
      extended bycom.opensymphony.webwork.dispatcher.StreamResult
All Implemented Interfaces:
com.opensymphony.xwork.Result, Serializable, WebWorkStatics

public class StreamResult
extends WebWorkResultSupport

Implements an XWork Result that takes an InputStream object available from a chained Action and redirects it to the browser.

The following declaration must be added to the xwork.xml file after the <package> element:

 <result-types>
 <result-type name="stream" class="com.opensymphony.webwork.dispatcher.StreamResult"/>
 </result-types>
 

To use the stream result type add the following as part of the action declaration:

 <result name="success" type="stream">
 <param name="contentType">image/jpeg</param>
 <param name="inputName">imageStream</param>
 <param name="contentDisposition">filename="document.pdf"</param>
 <param name="bufferSize">1024</param>
 </result>
 

Author:
mcrawford
See Also:
Serialized Form

Field Summary
protected  int bufferSize
           
protected  String contentDisposition
           
protected  String contentType
           
protected  String inputName
           
 
Fields inherited from class com.opensymphony.webwork.dispatcher.WebWorkResultSupport
DEFAULT_PARAM, parse
 
Fields inherited from interface com.opensymphony.webwork.WebWorkStatics
HTTP_REQUEST, HTTP_RESPONSE, PAGE_CONTEXT, SERLVET_DISPATCHER, SERVLET_CONFIG, SERVLET_DISPATCHER
 
Constructor Summary
StreamResult()
           
 
Method Summary
protected  void doExecute(String finalLocation, com.opensymphony.xwork.ActionInvocation invocation)
          Executes the result given a final location (jsp page, action, etc) and the action invocation (the state in which the action was executed).
 int getBufferSize()
           
 String getContentDisposition()
           
 String getContentType()
           
 String getInputName()
           
 void setBufferSize(int bufferSize)
           
 void setContentDisposition(String contentDisposition)
           
 void setContentType(String contentType)
           
 void setInputName(String inputName)
           
 
Methods inherited from class com.opensymphony.webwork.dispatcher.WebWorkResultSupport
conditionalParse, execute, setLocation, setParse
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

contentType

protected String contentType

contentDisposition

protected String contentDisposition

inputName

protected String inputName

bufferSize

protected int bufferSize
Constructor Detail

StreamResult

public StreamResult()
Method Detail

getBufferSize

public int getBufferSize()
Returns:
Returns the bufferSize.

setBufferSize

public void setBufferSize(int bufferSize)
Parameters:
bufferSize - The bufferSize to set.

getContentType

public String getContentType()
Returns:
Returns the contentType.

setContentType

public void setContentType(String contentType)
Parameters:
contentType - The contentType to set.

getContentDisposition

public String getContentDisposition()
Returns:
Returns the Content-disposition header value.

setContentDisposition

public void setContentDisposition(String contentDisposition)
Parameters:
contentDisposition - the Content-disposition header value to use.

getInputName

public String getInputName()
Returns:
Returns the inputName.

setInputName

public void setInputName(String inputName)
Parameters:
inputName - The inputName to set.

doExecute

protected void doExecute(String finalLocation,
                         com.opensymphony.xwork.ActionInvocation invocation)
                  throws Exception
Description copied from class: WebWorkResultSupport
Executes the result given a final location (jsp page, action, etc) and the action invocation (the state in which the action was executed). Subclasses must implement this class to handle custom logic for result handling.

Specified by:
doExecute in class WebWorkResultSupport
Parameters:
finalLocation - the location (jsp page, action, etc) to go to.
invocation - the execution state of the action.
Throws:
Exception - if an error occurs while executing the result.
See Also:
Result.execute(com.opensymphony.xwork.ActionInvocation)

WebWork Project Page