cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject cxf git commit: [CXF-6767] Accepting extra properties by default, can be disabled if needed
Date Wed, 03 Feb 2016 14:13:02 GMT
Repository: cxf
Updated Branches:
  refs/heads/3.1.x-fixes 12c325a12 -> b41c6ffd2


[CXF-6767] Accepting extra properties by default, can be disabled if needed


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

Branch: refs/heads/3.1.x-fixes
Commit: b41c6ffd206d841b4f2fb3b3c6400720a19869b5
Parents: 12c325a
Author: Sergey Beryozkin <sberyozkin@gmail.com>
Authored: Wed Feb 3 14:11:36 2016 +0000
Committer: Sergey Beryozkin <sberyozkin@gmail.com>
Committed: Wed Feb 3 14:12:41 2016 +0000

----------------------------------------------------------------------
 .../transport/http/osgi/ServletExporter.java    | 46 +++++++++++++-------
 1 file changed, 31 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/b41c6ffd/rt/transports/http/src/main/java/org/apache/cxf/transport/http/osgi/ServletExporter.java
----------------------------------------------------------------------
diff --git a/rt/transports/http/src/main/java/org/apache/cxf/transport/http/osgi/ServletExporter.java
b/rt/transports/http/src/main/java/org/apache/cxf/transport/http/osgi/ServletExporter.java
index aadb4ed..867dca1 100644
--- a/rt/transports/http/src/main/java/org/apache/cxf/transport/http/osgi/ServletExporter.java
+++ b/rt/transports/http/src/main/java/org/apache/cxf/transport/http/osgi/ServletExporter.java
@@ -19,6 +19,7 @@
 package org.apache.cxf.transport.http.osgi;
 
 import java.util.Dictionary;
+import java.util.Enumeration;
 import java.util.Properties;
 import java.util.logging.Level;
 import java.util.logging.Logger;
@@ -34,6 +35,8 @@ import org.osgi.service.http.HttpService;
 
 class ServletExporter implements ManagedService {
     protected static final Logger LOG = LogUtils.getL7dLogger(ServletExporter.class); 
+    private static final String CXF_SERVLET_PREFIX = "org.apache.cxf.servlet.";
+    
     private String alias;
     private Servlet servlet;
     private ServiceRegistration serviceRegistration;
@@ -56,37 +59,50 @@ class ServletExporter implements ManagedService {
         }
         Properties sprops = new Properties();
         sprops.put("init-prefix", 
-                   getProp(properties, "org.apache.cxf.servlet.init-prefix", ""));
+                   getProp(properties, CXF_SERVLET_PREFIX + "init-prefix", ""));
         sprops.put("servlet-name", 
-                   getProp(properties, "org.apache.cxf.servlet.name", "cxf-osgi-transport-servlet"));
+                   getProp(properties, CXF_SERVLET_PREFIX + "name", "cxf-osgi-transport-servlet"));
         sprops.put("hide-service-list-page", 
-                   getProp(properties, "org.apache.cxf.servlet.hide-service-list-page", "false"));
+                   getProp(properties, CXF_SERVLET_PREFIX + "hide-service-list-page", "false"));
         sprops.put("disable-address-updates", 
-                   getProp(properties, "org.apache.cxf.servlet.disable-address-updates",
"true"));
+                   getProp(properties, CXF_SERVLET_PREFIX + "disable-address-updates", "true"));
         sprops.put("base-address", 
-                   getProp(properties, "org.apache.cxf.servlet.base-address", ""));
+                   getProp(properties, CXF_SERVLET_PREFIX + "base-address", ""));
         sprops.put("service-list-path", 
-                   getProp(properties, "org.apache.cxf.servlet.service-list-path", ""));
+                   getProp(properties, CXF_SERVLET_PREFIX + "service-list-path", ""));
         sprops.put("static-resources-list", 
-                   getProp(properties, "org.apache.cxf.servlet.static-resources-list", ""));
+                   getProp(properties, CXF_SERVLET_PREFIX + "static-resources-list", ""));
         sprops.put("redirects-list", 
-                   getProp(properties, "org.apache.cxf.servlet.redirects-list", ""));
+                   getProp(properties, CXF_SERVLET_PREFIX + "redirects-list", ""));
         sprops.put("redirect-servlet-name", 
-                   getProp(properties, "org.apache.cxf.servlet.redirect-servlet-name", ""));
+                   getProp(properties, CXF_SERVLET_PREFIX + "redirect-servlet-name", ""));
         sprops.put("redirect-servlet-path", 
-                   getProp(properties, "org.apache.cxf.servlet.redirect-servlet-path", ""));
+                   getProp(properties, CXF_SERVLET_PREFIX + "redirect-servlet-path", ""));
         sprops.put("service-list-all-contexts", 
-                   getProp(properties, "org.apache.cxf.servlet.service-list-all-contexts",
""));
+                   getProp(properties, CXF_SERVLET_PREFIX + "service-list-all-contexts",
""));
         sprops.put("service-list-page-authenticate", 
-                   getProp(properties, "org.apache.cxf.servlet.service-list-page-authenticate",
"false"));
+                   getProp(properties, CXF_SERVLET_PREFIX + "service-list-page-authenticate",
"false"));
         sprops.put("service-list-page-authenticate-realm", 
-                   getProp(properties, "org.apache.cxf.servlet.service-list-page-authenticate-realm",
"karaf"));
+                   getProp(properties, CXF_SERVLET_PREFIX + "service-list-page-authenticate-realm",
"karaf"));
         sprops.put("use-x-forwarded-headers", 
-                   getProp(properties, "org.apache.cxf.servlet.use-x-forwarded-headers",
"false"));
+                   getProp(properties, CXF_SERVLET_PREFIX + "use-x-forwarded-headers", "false"));
+        
+        // Accept extra properties by default, can be disabled if it is really needed
+        if (Boolean.valueOf(getProp(properties, CXF_SERVLET_PREFIX + "support.extra.properties",
"true").toString())) {
+            Enumeration keys = properties.keys();
+            while (keys.hasMoreElements()) {
+                String nextKey = keys.nextElement().toString();
+                if (!nextKey.startsWith(CXF_SERVLET_PREFIX)) {
+                    sprops.put(nextKey, properties.get(nextKey));    
+                }
+            }
+        }
+        
+        
         if (serviceRegistration != null) {
             serviceRegistration.unregister();
         }
-        alias = (String)getProp(properties, "org.apache.cxf.servlet.context", "/cxf");
+        alias = (String)getProp(properties, CXF_SERVLET_PREFIX + "context", "/cxf");
         HttpContext context = httpService.createDefaultHttpContext();
         try {
             httpService.registerServlet(alias, servlet, sprops, context);


Mime
View raw message