public class HttpHeaderResult extends Object implements Result
<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> <result name="proxyRequired" type="httpheader"> <param name="error">305</param> <param name="errorMessage">this action must be accessed through a prozy</param> </result>
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_PARAM
This result type doesn't have a default param, null is ok to reduce noice in logs
|
Constructor and Description |
---|
HttpHeaderResult() |
HttpHeaderResult(int status) |
Modifier and Type | Method and Description |
---|---|
void |
addHeader(String name,
String value)
Adds an HTTP header to the response
|
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.
|
Map<String,String> |
getHeaders()
Returns a Map of all HTTP headers.
|
int |
getStatus() |
void |
setError(String error)
Sets the http servlet error code that should be set on the response
|
void |
setErrorMessage(String errorMessage)
Sets the error message that should be set on the reponse
|
void |
setParse(boolean parse)
Sets whether or not the HTTP header values should be evaluated against the ValueStack (by default they are).
|
void |
setStatus(int status)
Sets the http servlet response status code that should be set on a response.
|
public static final String DEFAULT_PARAM
public HttpHeaderResult()
public HttpHeaderResult(int status)
public void setError(String error)
error
- the Http error codeHttpServletResponse.sendError(int)
public void setErrorMessage(String errorMessage)
errorMessage
- error message send to the clientHttpServletResponse.sendError(int, String)
public Map<String,String> getHeaders()
public void setParse(boolean parse)
parse
- true if HTTP header values should be evaluated against the ValueStack, false
otherwise.public void setStatus(int status)
status
- the Http status codeHttpServletResponse.setStatus(int)
public int getStatus()
public void addHeader(String name, String value)
name
- header namevalue
- header valuepublic void execute(ActionInvocation invocation) throws Exception
Copyright © 2000-2013 Apache Software Foundation. All Rights Reserved.