You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by ni...@apache.org on 2014/05/22 10:21:18 UTC
[2/3] git commit: CXF-5740 Added a system property to stop checking
the url
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/dcf628bd
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/dcf628bd
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/dcf628bd
Branch: refs/heads/2.7.x-fixes
Commit: dcf628bd271d6bf0d03b4703cf50379117c00406
Parents: 9b5b62e
Author: Willem Jiang <wi...@gmail.com>
Authored: Thu May 22 15:26:44 2014 +0800
Committer: Willem Jiang <wi...@gmail.com>
Committed: Thu May 22 15:59:45 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/dcf628bd/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/dcf628bd/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().