public class StreamResult extends StrutsResultSupport
text/plain
).inline
, values are typically
attachment;filename="document.pdf".inputStream
).1024
).true
)
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.
<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>
Result.LegacyAdapter
Modifier and Type | Field and Description |
---|---|
protected boolean |
allowCaching |
protected int |
bufferSize |
protected String |
contentCharSet |
protected String |
contentDisposition |
protected String |
contentLength |
protected String |
contentType |
static String |
DEFAULT_PARAM |
protected String |
inputName |
protected InputStream |
inputStream |
protected static org.apache.logging.log4j.Logger |
LOG |
DEFAULT_URL_ENCODING, parseLocation
ACTION_MAPPING, HTTP_REQUEST, HTTP_RESPONSE, PAGE_CONTEXT, SERVLET_CONTEXT, SERVLET_DISPATCHER, STRUTS_ACTION_TAG_INVOCATION, STRUTS_PORTLET_CONTEXT
Constructor and Description |
---|
StreamResult() |
StreamResult(InputStream in) |
Modifier and Type | Method and Description |
---|---|
protected void |
doExecute(String finalLocation,
ActionInvocation invocation) |
boolean |
getAllowCaching() |
int |
getBufferSize() |
String |
getContentCharSet() |
String |
getContentDisposition() |
String |
getContentLength() |
String |
getContentType() |
String |
getInputName() |
protected boolean |
isAcceptableExpression(String expression)
Checks if expression doesn't contain vulnerable code
|
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) |
void |
setNotExcludedAcceptedPatterns(NotExcludedAcceptedPatternsChecker notExcludedAcceptedPatterns) |
conditionalParse, conditionalParseCollection, doExecute, execute, getLastFinalLocation, getLocation, setEncode, setLocation, setParse
protected static final org.apache.logging.log4j.Logger LOG
public static final String DEFAULT_PARAM
protected String contentType
protected String contentLength
protected String contentDisposition
protected String contentCharSet
protected String inputName
protected InputStream inputStream
protected int bufferSize
protected boolean allowCaching
public StreamResult()
public StreamResult(InputStream in)
public void setNotExcludedAcceptedPatterns(NotExcludedAcceptedPatternsChecker notExcludedAcceptedPatterns)
public boolean getAllowCaching()
public void setAllowCaching(boolean allowCaching)
allowCaching
- Enable caching.public int getBufferSize()
public void setBufferSize(int bufferSize)
bufferSize
- The bufferSize to set.public String getContentType()
public void setContentType(String contentType)
contentType
- The contentType to set.public String getContentLength()
public void setContentLength(String contentLength)
contentLength
- The contentLength to set.public String getContentDisposition()
public void setContentDisposition(String contentDisposition)
contentDisposition
- the Content-disposition header value to use.public String getContentCharSet()
public void setContentCharSet(String contentCharSet)
contentCharSet
- the charset to use on the header when sending the streampublic String getInputName()
public void setInputName(String inputName)
inputName
- The inputName to set.protected void doExecute(String finalLocation, ActionInvocation invocation) throws Exception
doExecute
in class StrutsResultSupport
Exception
StrutsResultSupport.doExecute(java.lang.String, com.opensymphony.xwork2.ActionInvocation)
protected boolean isAcceptableExpression(String expression)
expression
- of resultCopyright © 2000–2024 Apache Software Foundation. All rights reserved.