|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.struts2.dispatcher.StrutsResultSupport
org.apache.struts2.dispatcher.ServletRedirectResult
public class ServletRedirectResult
Calls the sendRedirect
method to the location specified. The response is told to redirect the
browser to the specified location (a new request from the client). The
consequence of doing this means that the action (action instance, action
errors, field errors, etc) that was just executed is lost and no longer
available. This is because actions are built on a single-thread model. The
only way to pass data is through the session or with web parameters
(url?name=value) which can be OGNL expressions.
This result follows the same rules from StrutsResultSupport
.
<result name="success" type="redirect"> <param name="location">foo.jsp</param> <param name="parse">false</param> </result>
Field Summary | |
---|---|
protected ActionMapper |
actionMapper
|
private static Logger |
LOG
|
protected boolean |
prependServletContext
|
protected Map<String,String> |
requestParameters
|
private static long |
serialVersionUID
|
protected int |
statusCode
|
protected boolean |
supressEmptyParameters
|
Fields inherited from class org.apache.struts2.dispatcher.StrutsResultSupport |
---|
DEFAULT_PARAM |
Fields inherited from interface org.apache.struts2.StrutsStatics |
---|
HTTP_REQUEST, HTTP_RESPONSE, PAGE_CONTEXT, SERVLET_CONTEXT, SERVLET_DISPATCHER, STRUTS_PORTLET_CONTEXT |
Constructor Summary | |
---|---|
ServletRedirectResult()
|
|
ServletRedirectResult(String location)
|
Method Summary | |
---|---|
ServletRedirectResult |
addParameter(String key,
Object value)
Adds a request parameter to be added to the redirect url |
protected void |
doExecute(String finalLocation,
ActionInvocation invocation)
Redirects to the location specified by calling HttpServletResponse.sendRedirect(String) . |
protected List<String> |
getProhibitedResultParams()
|
void |
handle(ReflectionException ex)
Handles a reflection exception |
private static boolean |
isPathUrl(String url)
|
protected void |
sendRedirect(HttpServletResponse response,
String finalLocation)
Sends the redirection. |
void |
setActionMapper(ActionMapper mapper)
|
void |
setPrependServletContext(boolean prependServletContext)
Sets whether or not to prepend the servlet context path to the redirected URL. |
void |
setStatusCode(int code)
|
void |
setSupressEmptyParameters(boolean supressEmptyParameters)
Sets the supressEmptyParameters option |
Methods inherited from class org.apache.struts2.dispatcher.StrutsResultSupport |
---|
conditionalParse, execute, getLastFinalLocation, getLocation, setEncode, setLocation, setParse |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final long serialVersionUID
private static final Logger LOG
protected boolean prependServletContext
protected ActionMapper actionMapper
protected int statusCode
protected boolean supressEmptyParameters
protected Map<String,String> requestParameters
Constructor Detail |
---|
public ServletRedirectResult()
public ServletRedirectResult(String location)
Method Detail |
---|
public void setActionMapper(ActionMapper mapper)
public void setStatusCode(int code)
public void setPrependServletContext(boolean prependServletContext)
prependServletContext
- true to prepend the location with the servlet context path,
false otherwise.protected void doExecute(String finalLocation, ActionInvocation invocation) throws Exception
HttpServletResponse.sendRedirect(String)
.
doExecute
in class StrutsResultSupport
finalLocation
- the location to redirect to.invocation
- an encapsulation of the action execution state.
Exception
- if an error occurs when redirecting.protected List<String> getProhibitedResultParams()
protected void sendRedirect(HttpServletResponse response, String finalLocation) throws IOException
response
- The responsefinalLocation
- The location URI
IOException
private static boolean isPathUrl(String url)
public void setSupressEmptyParameters(boolean supressEmptyParameters)
supressEmptyParameters
- The new value for this optionpublic ServletRedirectResult addParameter(String key, Object value)
key
- The parameter namevalue
- The parameter valuepublic void handle(ReflectionException ex)
ReflectionExceptionHandler
handle
in interface ReflectionExceptionHandler
ex
- The reflection exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |