org.apache.struts2.dispatcher
类 StreamResult

java.lang.Object
  继承者 org.apache.struts2.dispatcher.StrutsResultSupport
      继承者 org.apache.struts2.dispatcher.StreamResult
所有已实现的接口:
com.opensymphony.xwork2.Result, Serializable, StrutsStatics

public class StreamResult
extends StrutsResultSupport

A custom Result type for sending raw data (via an InputStream) directly to the HttpServletResponse. Very useful for allowing users to download content.

This result type takes the following parameters:

These parameters can also be set by exposing a similarly named getter method on your Action. For example, you can provide getContentType() to override that parameter for the current action.

Example:

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

另请参见:
序列化表格

字段摘要
static String DEFAULT_PARAM
           
 
从接口 org.apache.struts2.StrutsStatics 继承的字段
HTTP_REQUEST, HTTP_RESPONSE, PAGE_CONTEXT, SERVLET_CONTEXT, SERVLET_DISPATCHER, STRUTS_ACTION_TAG_INVOCATION, STRUTS_PORTLET_CONTEXT
 
构造方法摘要
StreamResult()
           
StreamResult(InputStream in)
           
 
方法摘要
 boolean getAllowCaching()
           
 int getBufferSize()
           
 String getContentCharSet()
           
 String getContentDisposition()
           
 String getContentLength()
           
 String getContentType()
           
 String getInputName()
           
 void setAllowCaching(boolean allowCaching)
          Set allowCaching to false to indicate that the client should be requested not to cache the data stream.
 void setBufferSize(int bufferSize)
           
 void setContentCharSet(String contentCharSet)
           
 void setContentDisposition(String contentDisposition)
           
 void setContentLength(String contentLength)
           
 void setContentType(String contentType)
           
 void setInputName(String inputName)
           
 
从类 org.apache.struts2.dispatcher.StrutsResultSupport 继承的方法
execute, getLastFinalLocation, getLocation, setEncode, setLocation, setParse
 
从类 java.lang.Object 继承的方法
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

字段详细信息

DEFAULT_PARAM

public static final String DEFAULT_PARAM
另请参见:
常量字段值
构造方法详细信息

StreamResult

public StreamResult()

StreamResult

public StreamResult(InputStream in)
方法详细信息

getAllowCaching

public boolean getAllowCaching()
返回:
Returns the whether or not the client should be requested to allow caching of the data stream.

setAllowCaching

public void setAllowCaching(boolean allowCaching)
Set allowCaching to false to indicate that the client should be requested not to cache the data stream. This is set to false by default

参数:
allowCaching - Enable caching.

getBufferSize

public int getBufferSize()
返回:
Returns the bufferSize.

setBufferSize

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

getContentType

public String getContentType()
返回:
Returns the contentType.

setContentType

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

getContentLength

public String getContentLength()
返回:
Returns the contentLength.

setContentLength

public void setContentLength(String contentLength)
参数:
contentLength - The contentLength to set.

getContentDisposition

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

setContentDisposition

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

getContentCharSet

public String getContentCharSet()
返回:
Returns the charset specified by the user

setContentCharSet

public void setContentCharSet(String contentCharSet)
参数:
contentCharSet - the charset to use on the header when sending the stream

getInputName

public String getInputName()
返回:
Returns the inputName.

setInputName

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