You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by lu...@apache.org on 2016/01/19 08:47:43 UTC

[2/4] struts git commit: made methods non static and private, javadoc updates

made methods non static and private, javadoc updates

Project: http://git-wip-us.apache.org/repos/asf/struts/repo
Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/7bd8dd95
Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/7bd8dd95
Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/7bd8dd95

Branch: refs/heads/master
Commit: 7bd8dd9559cbf964368ef5c3ee6f5768476bf8f7
Parents: cb11898
Author: cnenning <cn...@apache.org>
Authored: Tue Jan 12 14:14:09 2016 +0100
Committer: cnenning <cn...@apache.org>
Committed: Tue Jan 12 14:14:09 2016 +0100

----------------------------------------------------------------------
 .../validation/AjaxFormSubmitAction.java        |  2 +-
 .../struts2/json/JSONActionRedirectResult.java  | 23 ++++++++++----------
 2 files changed, 12 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/struts/blob/7bd8dd95/apps/showcase/src/main/java/org/apache/struts2/showcase/validation/AjaxFormSubmitAction.java
----------------------------------------------------------------------
diff --git a/apps/showcase/src/main/java/org/apache/struts2/showcase/validation/AjaxFormSubmitAction.java b/apps/showcase/src/main/java/org/apache/struts2/showcase/validation/AjaxFormSubmitAction.java
index b179370..50ff53f 100644
--- a/apps/showcase/src/main/java/org/apache/struts2/showcase/validation/AjaxFormSubmitAction.java
+++ b/apps/showcase/src/main/java/org/apache/struts2/showcase/validation/AjaxFormSubmitAction.java
@@ -23,7 +23,7 @@ import com.opensymphony.xwork2.validator.annotations.UrlValidator;
  * <ul>
  *   <li>Depends on <code>json-plugin</code>.</li>
  *   <li>Requires <code>jsonValidationInterceptor</code> to be on stack.</li>
- *   <li>Uses a special json redirect result type.</li>
+ *   <li>Uses result type <code>jsonActionRedirect</code>.</li>
  *   <li>Uses http parameters <code>struts.enableJSONValidation=true</code> and <code>struts.validateOnly=false</code>.</li>
  *   <li>Uses a customized theme to make sure html elements required as error containers are always present and easily selectable in JS.</li>
  *   <li>Uses some custom JS code depending on jQuery to issue AJAX request and to render errors in html.</li>

http://git-wip-us.apache.org/repos/asf/struts/blob/7bd8dd95/plugins/json/src/main/java/org/apache/struts2/json/JSONActionRedirectResult.java
----------------------------------------------------------------------
diff --git a/plugins/json/src/main/java/org/apache/struts2/json/JSONActionRedirectResult.java b/plugins/json/src/main/java/org/apache/struts2/json/JSONActionRedirectResult.java
index f0f3f39..40aa092 100644
--- a/plugins/json/src/main/java/org/apache/struts2/json/JSONActionRedirectResult.java
+++ b/plugins/json/src/main/java/org/apache/struts2/json/JSONActionRedirectResult.java
@@ -16,13 +16,12 @@ import org.apache.struts2.result.ServletActionRedirectResult;
  * 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>
+ * <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 {
@@ -30,7 +29,7 @@ public class JSONActionRedirectResult extends ServletActionRedirectResult {
     private static final long serialVersionUID = 3107276294073879542L;
 
     @Override
-	protected void sendRedirect(HttpServletResponse response, String finalLocation) throws IOException {
+    protected void sendRedirect(HttpServletResponse response, String finalLocation) throws IOException {
         if (sendJsonInsteadOfRedirect()) {
             printJson(response, finalLocation);
         } else {
@@ -45,12 +44,12 @@ public class JSONActionRedirectResult extends ServletActionRedirectResult {
      * @return true if a JSON response shall be generated, false if a redirect
      *         shall be sent.
      */
-    static boolean sendJsonInsteadOfRedirect() {
+    private boolean sendJsonInsteadOfRedirect() {
         HttpServletRequest request = ServletActionContext.getRequest();
         return isJsonEnabled(request) && !isValidateOnly(request);
     }
 
-    static void printJson(HttpServletResponse response, String finalLocation) throws IOException {
+    private void printJson(HttpServletResponse response, String finalLocation) throws IOException {
         response.setStatus(HttpServletResponse.SC_OK);
         response.setContentType("application/json");
         response.setHeader("Location", finalLocation);
@@ -61,11 +60,11 @@ public class JSONActionRedirectResult extends ServletActionRedirectResult {
         writer.close();
     }
 
-    private static boolean isJsonEnabled(HttpServletRequest request) {
+    private boolean isJsonEnabled(HttpServletRequest request) {
         return "true".equals(request.getParameter(JSONValidationInterceptor.VALIDATE_JSON_PARAM));
     }
 
-    private static boolean isValidateOnly(HttpServletRequest request) {
+    private boolean isValidateOnly(HttpServletRequest request) {
         return "true".equals(request.getParameter(JSONValidationInterceptor.VALIDATE_ONLY_PARAM));
     }
 }