cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject git commit: Support for multiple ParamConverterProvider in 2.7.x
Date Tue, 01 Jul 2014 11:26:09 GMT
Repository: cxf
Updated Branches:
  refs/heads/2.7.x-fixes b27448090 -> e33448ad1


Support for multiple ParamConverterProvider in 2.7.x


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

Branch: refs/heads/2.7.x-fixes
Commit: e33448ad1086c86fb510e9b2d3a24c60b35de677
Parents: b274480
Author: Sergey Beryozkin <sberyozkin@talend.com>
Authored: Tue Jul 1 12:25:18 2014 +0100
Committer: Sergey Beryozkin <sberyozkin@talend.com>
Committed: Tue Jul 1 12:25:18 2014 +0100

----------------------------------------------------------------------
 .../cxf/jaxrs/provider/ProviderFactory.java     | 24 ++++++++++++++------
 1 file changed, 17 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/e33448ad/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ProviderFactory.java
----------------------------------------------------------------------
diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ProviderFactory.java
b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ProviderFactory.java
index ce44efe..090bec6 100644
--- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ProviderFactory.java
+++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ProviderFactory.java
@@ -32,6 +32,7 @@ import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
@@ -131,7 +132,7 @@ public final class ProviderFactory {
     private List<ProviderInfo<ContextProvider<?>>> contextProviders = 
         new ArrayList<ProviderInfo<ContextProvider<?>>>(1);
     
-    private ParamConverterProvider newParamConverter;
+    private Set<ParamConverterProvider> newParamConverters;
     private LegacyParamConverterProvider legacyParamConverter; 
     
     private List<ProviderInfo<MessageBodyReader<?>>> jaxbReaders = 
@@ -385,14 +386,20 @@ public final class ProviderFactory {
     
     public <T> ParamConverter<T> createParameterHandler(Class<T> paramType,
Annotation[] anns) {
         
-        if (newParamConverter != null) {
+        if (newParamConverters != null) {
             anns = anns != null ? anns : new Annotation[]{};
-            return newParamConverter.getConverter(paramType, paramType, anns);
+            
+            for (ParamConverterProvider newParamConverter : newParamConverters) {
+                ParamConverter<T> converter = newParamConverter.getConverter(paramType,
paramType, anns);
+                if (converter != null) {
+                    return converter;
+                }
+            }
         } else if (legacyParamConverter != null) {
             return legacyParamConverter.getConverter(paramType, null, null);
-        } else {
-            return null;
-        }
+        } 
+        return null;
+        
     }
         
     @SuppressWarnings("unchecked")
@@ -811,7 +818,10 @@ public final class ProviderFactory {
             }
             
             if (ParamConverterProvider.class.isAssignableFrom(oClass)) {
-                newParamConverter = (ParamConverterProvider)o;
+                if (newParamConverters == null) {
+                    newParamConverters = new LinkedHashSet<ParamConverterProvider>();
+                }
+                newParamConverters.add((ParamConverterProvider)o);
             }
             
             if (ParameterHandler.class.isAssignableFrom(oClass)) {


Mime
View raw message