| |
|
| java.lang.Object org.apache.struts2.dispatcher.HttpHeaderResult
HttpHeaderResult | public class HttpHeaderResult implements Result(Code) | |
A custom Result type for setting HTTP headers and status by optionally evaluating against the ValueStack.
This result type takes the following parameters:
- status - the http servlet response status code that should be set on a response.
- parse - true by default. If set to false, the headers param will not be parsed for Ognl expressions.
- headers - header values.
Example:
<result name="success" type="httpheader">
<param name="status">204</param>
<param name="headers.a">a custom header value</param>
<param name="headers.b">another custom header value</param>
</result>
|
Method Summary | |
public void | addHeader(String name, String value) | public void | execute(ActionInvocation invocation) Sets the optional HTTP response status code and also re-sets HTTP headers after they've
been optionally evaluated against the ValueStack. | public Map | getHeaders() Returns a Map of all HTTP headers. | public void | setParse(boolean parse) Sets whether or not the HTTP header values should be evaluated against the ValueStack (by default they are). | public void | setStatus(int status) Sets the http servlet response status code that should be set on a response. |
DEFAULT_PARAM | final public static String DEFAULT_PARAM(Code) | | The default parameter
|
HttpHeaderResult | public HttpHeaderResult()(Code) | | |
HttpHeaderResult | public HttpHeaderResult(int status)(Code) | | |
addHeader | public void addHeader(String name, String value)(Code) | | Adds an HTTP header to the response
Parameters: name - Parameters: value - |
execute | public void execute(ActionInvocation invocation) throws Exception(Code) | | Sets the optional HTTP response status code and also re-sets HTTP headers after they've
been optionally evaluated against the ValueStack.
Parameters: invocation - an encapsulation of the action execution state. throws: Exception - if an error occurs when re-setting the headers. |
getHeaders | public Map getHeaders()(Code) | | Returns a Map of all HTTP headers.
a Map of all HTTP headers. |
setParse | public void setParse(boolean parse)(Code) | | Sets whether or not the HTTP header values should be evaluated against the ValueStack (by default they are).
Parameters: parse - true if HTTP header values should be evaluated agains the ValueStack, falseotherwise. |
|
|
|