struts-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lukaszlen...@apache.org
Subject [25/50] [abbrv] struts git commit: made methods non static and private, javadoc updates
Date Fri, 15 Jul 2016 13:18:52 GMT
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/8a2f083d
Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/8a2f083d
Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/8a2f083d

Branch: refs/heads/master
Commit: 8a2f083d5dc2a20abd267e3c3fa3bd696da804e5
Parents: f6d0e15
Author: cnenning <cnenning@apache.org>
Authored: Tue Jan 12 14:14:09 2016 +0100
Committer: Lukasz Lenart <lukasz.lenart@gmail.com>
Committed: Tue Jan 19 16:19:18 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/8a2f083d/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/8a2f083d/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));
     }
 }


Mime
View raw message