public class JSONActionRedirectResult extends ServletActionRedirectResult implements Redirectable
ServletActionRedirectResult which takes care of
situation that browser has a JS/AJAX context, there are no validation errors
and action is executed. In this case a http redirect is harmful as browsers
don't pass them to JS handlers. So this result produces a JSON response
containing redirect data.
To be used along with JSONValidationInterceptor.
Response JSON looks like this:
{"location": "$redirect url$"}
actionName, DEFAULT_PARAM, method, namespaceactionMapper, anchor, prependServletContext, requestParameters, statusCode, suppressEmptyParametersDEFAULT_URL_ENCODING, parseLocationHTTP_REQUEST, HTTP_RESPONSE, PAGE_CONTEXT, SERVLET_CONTEXT, SERVLET_DISPATCHER, STRUTS_ACTION_TAG_INVOCATION, STRUTS_PORTLET_CONTEXT| Constructor and Description |
|---|
JSONActionRedirectResult() |
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
isJsonEnabled(javax.servlet.http.HttpServletRequest request) |
protected boolean |
isValidateOnly(javax.servlet.http.HttpServletRequest request) |
protected void |
printJson(javax.servlet.http.HttpServletResponse response,
String finalLocation) |
protected boolean |
sendJsonInsteadOfRedirect()
If browser has called action in a JS/AJAX context we cannot send a
redirect as response.
|
protected void |
sendRedirect(javax.servlet.http.HttpServletResponse response,
String finalLocation) |
execute, getProhibitedResultParams, setActionName, setMethod, setNamespaceaddParameter, doExecute, handle, isPathUrl, setActionMapper, setAnchor, setPrependServletContext, setStatusCode, setSuppressEmptyParameters, setUrlHelperconditionalParse, conditionalParseCollection, getLastFinalLocation, getLocation, setEncode, setLocation, setParseclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waithandleprotected void sendRedirect(javax.servlet.http.HttpServletResponse response,
String finalLocation)
throws IOException
sendRedirect in class ServletRedirectResultIOExceptionprotected boolean sendJsonInsteadOfRedirect()
protected void printJson(javax.servlet.http.HttpServletResponse response,
String finalLocation)
throws IOException
IOExceptionprotected boolean isJsonEnabled(javax.servlet.http.HttpServletRequest request)
protected boolean isValidateOnly(javax.servlet.http.HttpServletRequest request)
Copyright © 2000–2019 Apache Software Foundation. All rights reserved.