cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject cxf git commit: Copying minor updates to CXFNonSpringJaxrsServlet 3.0.x made as part of bigger changes on the trunk
Date Wed, 17 Dec 2014 16:20:44 GMT
Repository: cxf
Updated Branches:
  refs/heads/2.7.x-fixes 16b7faf5e -> c4e334dc6


Copying minor updates to CXFNonSpringJaxrsServlet 3.0.x  made as part of bigger changes on
the trunk


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

Branch: refs/heads/2.7.x-fixes
Commit: c4e334dc6d25116d9e8b83742746c695e9528e55
Parents: 16b7faf
Author: Sergey Beryozkin <sberyozkin@talend.com>
Authored: Wed Dec 17 16:16:19 2014 +0000
Committer: Sergey Beryozkin <sberyozkin@talend.com>
Committed: Wed Dec 17 16:19:58 2014 +0000

----------------------------------------------------------------------
 .../jaxrs/servlet/CXFNonSpringJaxrsServlet.java | 26 +++++++++++++++++++-
 1 file changed, 25 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/c4e334dc/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/servlet/CXFNonSpringJaxrsServlet.java
----------------------------------------------------------------------
diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/servlet/CXFNonSpringJaxrsServlet.java
b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/servlet/CXFNonSpringJaxrsServlet.java
index 510d18e..953327b 100644
--- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/servlet/CXFNonSpringJaxrsServlet.java
+++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/servlet/CXFNonSpringJaxrsServlet.java
@@ -38,6 +38,7 @@ import org.apache.cxf.common.classloader.ClassLoaderUtils;
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.common.util.PrimitiveUtils;
 import org.apache.cxf.common.util.StringUtils;
+import org.apache.cxf.feature.Feature;
 import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.interceptor.Interceptor;
 import org.apache.cxf.jaxrs.JAXRSServerFactoryBean;
@@ -62,6 +63,7 @@ public class CXFNonSpringJaxrsServlet extends CXFNonSpringServlet {
     private static final String IGNORE_APP_PATH_PARAM = "jaxrs.application.address.ignore";
     private static final String SERVICE_CLASSES_PARAM = "jaxrs.serviceClasses";
     private static final String PROVIDERS_PARAM = "jaxrs.providers";
+    private static final String FEATURES_PARAM = "jaxrs.features";
     private static final String OUT_INTERCEPTORS_PARAM = "jaxrs.outInterceptors";
     private static final String OUT_FAULT_INTERCEPTORS_PARAM = "jaxrs.outFaultInterceptors";
     private static final String IN_INTERCEPTORS_PARAM = "jaxrs.inInterceptors";
@@ -128,10 +130,32 @@ public class CXFNonSpringJaxrsServlet extends CXFNonSpringServlet {
             bean.setResourceProvider(entry.getKey(), entry.getValue());
         }
         setExtensions(bean, servletConfig);
-                
+        List<? extends Feature> features = getFeatures(servletConfig, splitChar);
+        bean.setFeatures(features);        
         bean.create();
     }
 
+    protected List<? extends Feature> getFeatures(ServletConfig servletConfig, String
splitChar) 
+        throws ServletException {
+                    
+        String featuresList = servletConfig.getInitParameter(FEATURES_PARAM);
+        if (featuresList == null) {
+            return Collections.< Feature >emptyList();
+        }
+        String[] classNames = StringUtils.split(featuresList, splitChar);
+        List< Feature > features = new ArrayList< Feature >();
+        for (String cName : classNames) {
+            Map<String, List<String>> props = new HashMap<String, List<String>>();
+            String theName = getClassNameAndProperties(cName, props);
+            if (theName.length() != 0) {
+                Class<?> cls = loadClass(theName);
+                if (Feature.class.isAssignableFrom(cls)) {
+                    features.add((Feature)createSingletonInstance(cls, props, servletConfig));
+                }
+            }
+        }
+        return features;
+    }
     protected String getParameterSplitChar(ServletConfig servletConfig) {
         String param = servletConfig.getInitParameter(PARAMETER_SPLIT_CHAR);
         if (!StringUtils.isEmpty(param) && SPACE_PARAMETER_SPLIT_CHAR.equals(param.trim()))
{


Mime
View raw message