Github user lukaszlenart commented on a diff in the pull request: https://github.com/apache/struts/pull/72#discussion_r49329166 --- Diff: plugins/json/src/main/java/org/apache/struts2/json/JSONActionRedirectResult.java --- @@ -0,0 +1,71 @@ +package org.apache.struts2.json; + +import java.io.IOException; +import java.io.PrintWriter; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.struts2.ServletActionContext; +import org.apache.struts2.result.ServletActionRedirectResult; + +/** + * Specialized form of {@link 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. + * + *<p> + * To be used along with {@link JSONValidationInterceptor}. + *</p> + *<p> + * Response JSON looks like this: + * <pre>{"location": "$redirect url$"}</pre> + *</p> + * + */ +public class JSONActionRedirectResult extends ServletActionRedirectResult { + + private static final long serialVersionUID = 3107276294073879542L; + + @Override + protected void sendRedirect(HttpServletResponse response, String finalLocation) throws IOException { --- End diff -- Problem with indent?
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@struts.apache.org For additional commands, e-mail: dev-h...@struts.apache.org