cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ningji...@apache.org
Subject [1/3] git commit: CXF-5740 Added a system property to stop checking the url
Date Thu, 22 May 2014 08:21:17 GMT
Repository: cxf
Updated Branches:
  refs/heads/2.6.x-fixes 100cf6eb2 -> d8fbcd0c2
  refs/heads/2.7.x-fixes 9b5b62e1d -> dcf628bd2
  refs/heads/master 8ac7958af -> 3aa98577a


CXF-5740 Added a system property to stop checking the url


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

Branch: refs/heads/master
Commit: 3aa98577aab4554fe61ceeecdaf98b73fd6865dd
Parents: 8ac7958
Author: Willem Jiang <willem.jiang@gmail.com>
Authored: Thu May 22 15:26:44 2014 +0800
Committer: Willem Jiang <willem.jiang@gmail.com>
Committed: Thu May 22 15:30:19 2014 +0800

----------------------------------------------------------------------
 .../http_jetty/JettyHTTPServerEngine.java       | 33 +++++++++++++-------
 .../http_jetty/JettyHTTPServerEngineTest.java   |  6 ++++
 2 files changed, 27 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/3aa98577/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngine.java
----------------------------------------------------------------------
diff --git a/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngine.java
b/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngine.java
index 6a25ee3..3f824ec 100644
--- a/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngine.java
+++ b/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngine.java
@@ -98,6 +98,7 @@ public class JettyHTTPServerEngine
     private Container.Listener mBeanContainer;
     private SessionManager sessionManager;
     
+    
     /**
      * This field holds the TLS ServerParameters that are programatically
      * configured. The tlsServerParamers (due to JAXB) holds the struct
@@ -209,6 +210,12 @@ public class JettyHTTPServerEngine
         return !Boolean.valueOf(s);
     }
     
+    private boolean shouldCheckUrl() {
+        String s = SystemPropertyAction
+            .getPropertyOrNull("org.apache.cxf.transports.http_jetty.DontCheckUrl");
+        return !Boolean.valueOf(s);
+    }
+    
     /**
      * get the jetty server instance
      * @return
@@ -275,18 +282,20 @@ public class JettyHTTPServerEngine
     }
     
     protected void checkRegistedContext(URL url) {
-        String path = url.getPath();
-        for (String registedPath : registedPaths) {
-            if (path.equals(registedPath)) {
-                throw new Fault(new Message("ADD_HANDLER_CONTEXT_IS_USED_MSG", LOG, url,
registedPath));
-            }
-            // There are some context path conflicts which could cause the JettyHTTPServerEngine

-            // doesn't route the message to the right JettyHTTPHandler
-            if (path.equals(HttpUriMapper.getContextName(registedPath))) {
-                throw new Fault(new Message("ADD_HANDLER_CONTEXT_IS_USED_MSG", LOG, url,
registedPath));
-            }
-            if (registedPath.equals(HttpUriMapper.getContextName(path))) {
-                throw new Fault(new Message("ADD_HANDLER_CONTEXT_CONFILICT_MSG", LOG, url,
registedPath));
+        if (shouldCheckUrl()) {
+            String path = url.getPath();
+            for (String registedPath : registedPaths) {
+                if (path.equals(registedPath)) {
+                    throw new Fault(new Message("ADD_HANDLER_CONTEXT_IS_USED_MSG", LOG, url,
registedPath));
+                }
+                // There are some context path conflicts which could cause the JettyHTTPServerEngine

+                // doesn't route the message to the right JettyHTTPHandler
+                if (path.equals(HttpUriMapper.getContextName(registedPath))) {
+                    throw new Fault(new Message("ADD_HANDLER_CONTEXT_IS_USED_MSG", LOG, url,
registedPath));
+                }
+                if (registedPath.equals(HttpUriMapper.getContextName(path))) {
+                    throw new Fault(new Message("ADD_HANDLER_CONTEXT_CONFILICT_MSG", LOG,
url, registedPath));
+                }
             }
         }
     }

http://git-wip-us.apache.org/repos/asf/cxf/blob/3aa98577/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngineTest.java
----------------------------------------------------------------------
diff --git a/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngineTest.java
b/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngineTest.java
index b5ab2a6..bcf6735 100644
--- a/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngineTest.java
+++ b/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngineTest.java
@@ -214,6 +214,12 @@ public class JettyHTTPServerEngineTest extends Assert {
             assertTrue("Get a wrong exception message", ex.getMessage().indexOf("hello")
> 0);
         }
         
+        // check if the system property change could work
+        System.setProperty("org.apache.cxf.transports.http_jetty.DontCheckUrl", "true");
+        engine.addServant(new URL(urlStr + "/test"), handler2);
+        // clean up the System property setting
+        System.clearProperty("org.apache.cxf.transports.http_jetty.DontCheckUrl");
+        
         engine.addServant(new URL(urlStr2), handler2);
         
         Set<ObjectName>  s = CastUtils.cast(ManagementFactory.getPlatformMBeanServer().


Mime
View raw message