cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ningji...@apache.org
Subject git commit: CXF-5610 check the context path conflict
Date Fri, 04 Apr 2014 10:58:11 GMT
Repository: cxf
Updated Branches:
  refs/heads/2.6.x-fixes 9c20cb35a -> e0099772d


CXF-5610 check the context path conflict


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

Branch: refs/heads/2.6.x-fixes
Commit: e0099772d5c5bfb132780845fefdf21e96703b4b
Parents: 9c20cb3
Author: Willem Jiang <willem.jiang@gmail.com>
Authored: Fri Apr 4 18:57:07 2014 +0800
Committer: Willem Jiang <willem.jiang@gmail.com>
Committed: Fri Apr 4 18:57:32 2014 +0800

----------------------------------------------------------------------
 .../transport/http_jetty/JettyHTTPServerEngine.java   |  8 ++++++++
 .../http_jetty/JettyHTTPServerEngineTest.java         | 14 ++++++++++++++
 2 files changed, 22 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/e0099772/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 003024a..154e8b9 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
@@ -281,6 +281,14 @@ public class JettyHTTPServerEngine
             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/e0099772/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 2876a36..add1e86 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
@@ -200,6 +200,20 @@ public class JettyHTTPServerEngineTest extends Assert {
             assertTrue("Get a wrong exception message", ex.getMessage().indexOf("hello/test")
> 0);
         }
         
+        try {
+            engine.addServant(new URL(urlStr + "/test"), handler2);
+            fail("We don't support to publish the two service at the same context path");
+        } catch (Exception ex) {
+            assertTrue("Get a wrong exception message", ex.getMessage().indexOf("hello/test/test")
> 0);
+        }
+        
+        try {
+            engine.addServant(new URL("http://localhost:" + PORT1 + "/hello"), handler2);
+            fail("We don't support to publish the two service at the same context path");
+        } catch (Exception ex) {
+            assertTrue("Get a wrong exception message", ex.getMessage().indexOf("hello")
> 0);
+        }
+        
         engine.addServant(new URL(urlStr2), handler2);
         
         Set<ObjectName>  s = CastUtils.cast(ManagementFactory.getPlatformMBeanServer().


Mime
View raw message