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 2014/03/19 09:38:57 UTC

[1/5] git commit: Uses URL class to check if location is path or full url

Repository: struts
Updated Branches:
  refs/heads/develop 561063a42 -> ae12bd765


Uses URL class to check if location is path or full url


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

Branch: refs/heads/develop
Commit: 4b7d2e35d09225a7c8b3b410588131b692b2730f
Parents: bcd61a0
Author: Lukasz Lenart <lu...@apache.org>
Authored: Sun Mar 9 21:46:33 2014 +0100
Committer: Lukasz Lenart <lu...@apache.org>
Committed: Sun Mar 9 21:46:33 2014 +0100

----------------------------------------------------------------------
 .../dispatcher/ServletRedirectResult.java       | 23 ++++++++++++++------
 1 file changed, 16 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/struts/blob/4b7d2e35/core/src/main/java/org/apache/struts2/dispatcher/ServletRedirectResult.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/dispatcher/ServletRedirectResult.java b/core/src/main/java/org/apache/struts2/dispatcher/ServletRedirectResult.java
index abc69eb..038d8c3 100644
--- a/core/src/main/java/org/apache/struts2/dispatcher/ServletRedirectResult.java
+++ b/core/src/main/java/org/apache/struts2/dispatcher/ServletRedirectResult.java
@@ -37,6 +37,9 @@ import org.apache.struts2.views.util.UrlHelper;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
+import java.net.HttpURLConnection;
+import java.net.URI;
+import java.net.URLConnection;
 import java.util.*;
 
 import static javax.servlet.http.HttpServletResponse.SC_FOUND;
@@ -262,13 +265,19 @@ public class ServletRedirectResult extends StrutsResultSupport implements Reflec
 
     }
 
-    private boolean isPathUrl(String url) {
-        // filter out "http:", "https:", "mailto:", "file:", "ftp:"
-        return !url.startsWith("http:")
-                && !url.startsWith("https:")
-                && !url.startsWith("mailto:")
-                && !url.startsWith("file:")
-                && !url.startsWith("ftp:");
+    /**
+     * Checks if url is simple path or either full url
+     *
+     * @param url string
+     * @return true if it's just a path not a full url
+     */
+    protected boolean isPathUrl(String url) {
+        try {
+            return URI.create(url).getScheme() == null;
+        } catch (IllegalArgumentException e) {
+            LOG.debug("[#0] isn't a valid URL", e, url);
+            return false;
+        }
     }
 
     /**


[4/5] git commit: Merge branch 'develop' into feature/WW-4187-correctly-identify-protocols

Posted by lu...@apache.org.
Merge branch 'develop' into feature/WW-4187-correctly-identify-protocols


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

Branch: refs/heads/develop
Commit: 3c1d25c04f1d1a65fca15d1c2de062dd1ae54f34
Parents: d59fb2b 561063a
Author: Lukasz Lenart <lu...@apache.org>
Authored: Wed Mar 19 08:52:14 2014 +0100
Committer: Lukasz Lenart <lu...@apache.org>
Committed: Wed Mar 19 08:52:14 2014 +0100

----------------------------------------------------------------------
 .../struts2/components/GenericUIBean.java       |  5 +-
 .../org/apache/struts2/components/Hidden.java   |  7 ++
 .../org/apache/struts2/components/UIBean.java   |  9 ++-
 .../template/xhtml/form-close-validate.ftl      |  2 +-
 .../main/resources/template/xhtml/hidden.ftl    | 27 +++++++
 .../apache/struts2/StrutsInternalTestCase.java  |  9 ++-
 .../struts2/views/jsp/AbstractTagTest.java      |  4 +-
 .../apache/struts2/views/jsp/ui/Hidden-1.txt    |  6 +-
 .../apache/struts2/views/jsp/ui/Hidden-2.txt    |  6 +-
 .../com/opensymphony/xwork2/util/URLUtil.java   |  1 +
 ...nnotationValidationConfigurationBuilder.java |  6 ++
 .../validator/annotations/UrlValidator.java     | 76 +++-----------------
 .../validator/validators/URLValidator.java      | 66 +++++++++++------
 .../xwork2/validator/URLValidatorTest.java      | 50 +++++++++++++
 14 files changed, 170 insertions(+), 104 deletions(-)
----------------------------------------------------------------------



[2/5] git commit: Extends logic how protocol part of url is extracted

Posted by lu...@apache.org.
Extends logic how protocol part of url is extracted


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

Branch: refs/heads/develop
Commit: 1ca55b8a79cc118128391bddd3b776024def79f8
Parents: 4b7d2e3
Author: Lukasz Lenart <lu...@apache.org>
Authored: Sun Mar 9 21:57:58 2014 +0100
Committer: Lukasz Lenart <lu...@apache.org>
Committed: Sun Mar 9 21:57:58 2014 +0100

----------------------------------------------------------------------
 .../dispatcher/ServletRedirectResult.java       | 26 +++++++++++++++++---
 1 file changed, 22 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/struts/blob/1ca55b8a/core/src/main/java/org/apache/struts2/dispatcher/ServletRedirectResult.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/dispatcher/ServletRedirectResult.java b/core/src/main/java/org/apache/struts2/dispatcher/ServletRedirectResult.java
index 038d8c3..9820295 100644
--- a/core/src/main/java/org/apache/struts2/dispatcher/ServletRedirectResult.java
+++ b/core/src/main/java/org/apache/struts2/dispatcher/ServletRedirectResult.java
@@ -37,9 +37,8 @@ import org.apache.struts2.views.util.UrlHelper;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
-import java.net.HttpURLConnection;
+import java.net.MalformedURLException;
 import java.net.URI;
-import java.net.URLConnection;
 import java.util.*;
 
 import static javax.servlet.http.HttpServletResponse.SC_FOUND;
@@ -273,9 +272,28 @@ public class ServletRedirectResult extends StrutsResultSupport implements Reflec
      */
     protected boolean isPathUrl(String url) {
         try {
-            return URI.create(url).getScheme() == null;
+            URI uri = URI.create(url);
+            if (uri.isAbsolute()) {
+                uri.toURL();
+                if (LOG.isDebugEnabled()) {
+                    LOG.debug("[#0] is full url, not a path", url);
+                }
+                return true;
+            } else {
+                if (LOG.isDebugEnabled()) {
+                    LOG.debug("[#0] isn't absolute URI, assuming it's a path", url);
+                }
+                return false;
+            }
         } catch (IllegalArgumentException e) {
-            LOG.debug("[#0] isn't a valid URL", e, url);
+            if (LOG.isDebugEnabled()) {
+                LOG.debug("[#0] isn't a valid URL, assuming it's a path", e, url);
+            }
+            return false;
+        } catch (MalformedURLException e) {
+            if (LOG.isDebugEnabled()) {
+                LOG.debug("[#0] isn't a valid URL, assuming it's a path", e, url);
+            }
             return false;
         }
     }


[3/5] git commit: Reverts returned values to match logic and checks if protocol is not null

Posted by lu...@apache.org.
Reverts returned values to match logic and checks if protocol is not null


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

Branch: refs/heads/develop
Commit: d59fb2b9ecd6e43a9029583f720002a072d965fb
Parents: 1ca55b8
Author: Lukasz Lenart <lu...@apache.org>
Authored: Wed Mar 19 08:50:56 2014 +0100
Committer: Lukasz Lenart <lu...@apache.org>
Committed: Wed Mar 19 08:50:56 2014 +0100

----------------------------------------------------------------------
 .../apache/struts2/dispatcher/ServletRedirectResult.java | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/struts/blob/d59fb2b9/core/src/main/java/org/apache/struts2/dispatcher/ServletRedirectResult.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/dispatcher/ServletRedirectResult.java b/core/src/main/java/org/apache/struts2/dispatcher/ServletRedirectResult.java
index 9820295..e4347b0 100644
--- a/core/src/main/java/org/apache/struts2/dispatcher/ServletRedirectResult.java
+++ b/core/src/main/java/org/apache/struts2/dispatcher/ServletRedirectResult.java
@@ -39,6 +39,7 @@ import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
 import java.net.MalformedURLException;
 import java.net.URI;
+import java.net.URL;
 import java.util.*;
 
 import static javax.servlet.http.HttpServletResponse.SC_FOUND;
@@ -274,27 +275,27 @@ public class ServletRedirectResult extends StrutsResultSupport implements Reflec
         try {
             URI uri = URI.create(url);
             if (uri.isAbsolute()) {
-                uri.toURL();
+                URL validUrl = uri.toURL();
                 if (LOG.isDebugEnabled()) {
                     LOG.debug("[#0] is full url, not a path", url);
                 }
-                return true;
+                return validUrl.getProtocol() == null;
             } else {
                 if (LOG.isDebugEnabled()) {
                     LOG.debug("[#0] isn't absolute URI, assuming it's a path", url);
                 }
-                return false;
+                return true;
             }
         } catch (IllegalArgumentException e) {
             if (LOG.isDebugEnabled()) {
                 LOG.debug("[#0] isn't a valid URL, assuming it's a path", e, url);
             }
-            return false;
+            return true;
         } catch (MalformedURLException e) {
             if (LOG.isDebugEnabled()) {
                 LOG.debug("[#0] isn't a valid URL, assuming it's a path", e, url);
             }
-            return false;
+            return true;
         }
     }
 


[5/5] git commit: WW-4187 finshes work: protocols are identified based on URL class

Posted by lu...@apache.org.
WW-4187 finshes work: protocols are identified based on URL class


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

Branch: refs/heads/develop
Commit: ae12bd76551baab3ab9e3df7655fe579e526c5d7
Parents: 561063a 3c1d25c
Author: Lukasz Lenart <lu...@apache.org>
Authored: Wed Mar 19 09:38:10 2014 +0100
Committer: Lukasz Lenart <lu...@apache.org>
Committed: Wed Mar 19 09:38:10 2014 +0100

----------------------------------------------------------------------
 .../dispatcher/ServletRedirectResult.java       | 42 ++++++++++++++++----
 1 file changed, 35 insertions(+), 7 deletions(-)
----------------------------------------------------------------------