cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject git commit: [CXF-5593] Passing parameter annotations to ParamConverterprovider
Date Wed, 05 Mar 2014 13:32:38 GMT
Repository: cxf
Updated Branches:
  refs/heads/2.7.x-fixes dd1dc8ae2 -> d94e70f71


[CXF-5593] Passing parameter annotations to ParamConverterprovider


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

Branch: refs/heads/2.7.x-fixes
Commit: d94e70f71809bc0475c0a571f35cb71033fa2b0a
Parents: dd1dc8a
Author: Sergey Beryozkin <sberyozkin@talend.com>
Authored: Wed Mar 5 11:22:17 2014 +0000
Committer: Sergey Beryozkin <sberyozkin@talend.com>
Committed: Wed Mar 5 13:32:04 2014 +0000

----------------------------------------------------------------------
 .../apache/cxf/jaxrs/client/AbstractClient.java | 31 +++----
 .../cxf/jaxrs/client/ClientProxyImpl.java       | 92 +++++++++++---------
 .../org/apache/cxf/jaxrs/client/WebClient.java  |  6 +-
 .../cxf/jaxrs/provider/ProviderFactory.java     |  8 +-
 .../apache/cxf/jaxrs/utils/InjectionUtils.java  | 12 +--
 .../cxf/jaxrs/provider/ProviderFactoryTest.java |  2 +-
 6 files changed, 79 insertions(+), 72 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/d94e70f7/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/AbstractClient.java
----------------------------------------------------------------------
diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/AbstractClient.java
b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/AbstractClient.java
index ad88128..2f502a2 100644
--- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/AbstractClient.java
+++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/AbstractClient.java
@@ -127,10 +127,10 @@ public abstract class AbstractClient implements Client, Retryable {
             if (values.length > 1) {
                 throw new IllegalArgumentException("Content-Type can have a single value
only");
             }
-            type(convertParamValue(values[0]));
+            type(convertParamValue(values[0], null));
         } else {
             for (Object o : values) {
-                possiblyAddHeader(name, convertParamValue(o));
+                possiblyAddHeader(name, convertParamValue(o, null));
             }
         }
         return this;
@@ -674,6 +674,7 @@ public abstract class AbstractClient implements Client, Retryable {
     protected void addMatrixQueryParamsToBuilder(UriBuilder ub, 
                                                  String paramName, 
                                                  ParameterType pt,
+                                                 Annotation[] anns,
                                                  Object... pValues) {
         if (pt != ParameterType.MATRIX && pt != ParameterType.QUERY) {
             throw new IllegalArgumentException("This method currently deal "
@@ -686,10 +687,10 @@ public abstract class AbstractClient implements Client, Retryable {
                         Collection<?> c = pValue.getClass().isArray() 
                             ? Arrays.asList((Object[]) pValue) : (Collection<?>) pValue;
                         for (Iterator<?> it = c.iterator(); it.hasNext();) {
-                            convertMatrixOrQueryToBuilder(ub, paramName, it.next(), pt);
+                            convertMatrixOrQueryToBuilder(ub, paramName, it.next(), pt, anns);
                         }
                     } else { 
-                        convertMatrixOrQueryToBuilder(ub, paramName, pValue, pt); 
+                        convertMatrixOrQueryToBuilder(ub, paramName, pValue, pt, anns); 
                     }
                 }
             } else {
@@ -701,7 +702,7 @@ public abstract class AbstractClient implements Client, Retryable {
                 InjectionUtils.extractValuesFromBean(pValue, "");
             for (Map.Entry<String, List<Object>> entry : values.entrySet()) {
                 for (Object v : entry.getValue()) {
-                    convertMatrixOrQueryToBuilder(ub, entry.getKey(), v, pt);
+                    convertMatrixOrQueryToBuilder(ub, entry.getKey(), v, pt, anns);
                 }
             }
         }
@@ -710,8 +711,9 @@ public abstract class AbstractClient implements Client, Retryable {
     private void convertMatrixOrQueryToBuilder(UriBuilder ub, 
                                            String paramName, 
                                            Object pValue,
-                                           ParameterType pt) {
-        Object convertedValue = convertParamValue(pValue);
+                                           ParameterType pt,
+                                           Annotation[] anns) {
+        Object convertedValue = convertParamValue(pValue, anns);
         addMatrixOrQueryToBuilder(ub, paramName, pt, convertedValue);
     }
     
@@ -727,24 +729,15 @@ public abstract class AbstractClient implements Client, Retryable {
     }
     
     
-    protected String convertParamValue(Object pValue) {
+    protected String convertParamValue(Object pValue, Annotation[] anns) {
         if (pValue == null) {
             return null;
         }
-        Class<?> pClass = pValue.getClass();
-        if (pClass == String.class || pClass.isPrimitive()) {
-            return pValue.toString();
-        }
-        
-        // A little scope for some optimization exists, particularly,
-        // it is feasible a complex object may need to be repeatedly converted
-        // so we can keep a map of ParamConverter on the bus, that said
-        // it seems an over-optimization at this stage, it's a 5% case;
-        // typical requests have a limited number of simple URI parameters
         ProviderFactory pf = ProviderFactory.getInstance(cfg.getBus());
         if (pf != null) {
+            Class<?> pClass = pValue.getClass();
             @SuppressWarnings("unchecked")
-            ParamConverter<Object> prov = (ParamConverter<Object>)pf.createParameterHandler(pClass);
+            ParamConverter<Object> prov = (ParamConverter<Object>)pf.createParameterHandler(pClass,
anns);
             if (prov != null) {
                 return prov.toString(pValue);
             }

http://git-wip-us.apache.org/repos/asf/cxf/blob/d94e70f7/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/ClientProxyImpl.java
----------------------------------------------------------------------
diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/ClientProxyImpl.java
b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/ClientProxyImpl.java
index f9c0e99..abd5a56 100644
--- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/ClientProxyImpl.java
+++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/ClientProxyImpl.java
@@ -159,10 +159,10 @@ public class ClientProxyImpl extends AbstractClient implements
             reportInvalidResourceMethod(m, "INVALID_RESOURCE_METHOD");
         }
         
-        MultivaluedMap<ParameterType, Parameter> types = getParametersInfo(params,
ori);
+        MultivaluedMap<ParameterType, Parameter> types = getParametersInfo(m, params,
ori);
         List<Parameter> beanParamsList =  getParameters(types, ParameterType.BEAN);
         
-        List<Object> pathParams = getPathParamValues(types, beanParamsList, params,
ori);
+        List<Object> pathParams = getPathParamValues(m, params, types, beanParamsList,
ori);
         
         int bodyIndex = getBodyIndex(types, ori);
         
@@ -172,15 +172,15 @@ public class ClientProxyImpl extends AbstractClient implements
         }
         addNonEmptyPath(builder, ori.getURITemplate().getValue());
         
-        handleMatrixes(types, beanParamsList, params, builder);
-        handleQueries(types, beanParamsList, params, builder);
+        handleMatrixes(m, params, types, beanParamsList, builder);
+        handleQueries(m, params, types, beanParamsList, builder);
         
         URI uri = builder.buildFromEncoded(pathParams.toArray()).normalize();
         
         MultivaluedMap<String, String> headers = getHeaders();
         MultivaluedMap<String, String> paramHeaders = new MetadataMap<String, String>();
-        handleHeaders(paramHeaders, beanParamsList, types, params);
-        handleCookies(paramHeaders, beanParamsList, types, params);
+        handleHeaders(m, params, paramHeaders, beanParamsList, types);
+        handleCookies(m, params, paramHeaders, beanParamsList, types);
                 
         if (ori.isSubResourceLocator()) {
             ClassResourceInfo subCri = cri.getSubResource(m.getReturnType(), m.getReturnType());
@@ -226,7 +226,7 @@ public class ClientProxyImpl extends AbstractClient implements
         }
     }
     
-    private static MultivaluedMap<ParameterType, Parameter> getParametersInfo(
+    private static MultivaluedMap<ParameterType, Parameter> getParametersInfo(Method
m,
         Object[] params, OperationResourceInfo ori) {
         MultivaluedMap<ParameterType, Parameter> map = 
             new MetadataMap<ParameterType, Parameter>();
@@ -238,7 +238,7 @@ public class ClientProxyImpl extends AbstractClient implements
         int requestBodyParam = 0;
         int multipartParam = 0;
         for (Parameter p : parameters) {
-            if (isIgnorableParameter(ori, p)) {
+            if (isIgnorableParameter(m, p)) {
                 continue;
             }
             if (p.getType() == ParameterType.REQUEST_BODY) {
@@ -261,16 +261,13 @@ public class ClientProxyImpl extends AbstractClient implements
         return map;
     }
     
-    private static boolean isIgnorableParameter(OperationResourceInfo ori, Parameter p) {
+    private static boolean isIgnorableParameter(Method m, Parameter p) {
         if (p.getType() == ParameterType.CONTEXT) {
             return true;
         }
-        if (p.getType() == ParameterType.REQUEST_BODY) { 
-            Method m = ori.getAnnotatedMethod();
-            if (m != null 
-                && m.getParameterTypes()[p.getIndex()] == AsyncResponse.class) {
-                return true;
-            }
+        if (p.getType() == ParameterType.REQUEST_BODY
+            && m.getParameterTypes()[p.getIndex()] == AsyncResponse.class) {
+            return true;
         }
         return false;
     }
@@ -382,9 +379,10 @@ public class ClientProxyImpl extends AbstractClient implements
         return types;
     }
     
-    private List<Object> getPathParamValues(MultivaluedMap<ParameterType, Parameter>
map,
-                                            List<Parameter> beanParams,   
+    private List<Object> getPathParamValues(Method m,
                                             Object[] params,
+                                            MultivaluedMap<ParameterType, Parameter>
map,
+                                            List<Parameter> beanParams,   
                                             OperationResourceInfo ori) {
         List<Object> list = new LinkedList<Object>();
         if (isRoot) {
@@ -414,9 +412,9 @@ public class ClientProxyImpl extends AbstractClient implements
         for (String varName : methodVars) {
             Parameter p = paramsMap.remove(varName);
             if (p != null) {
-                list.add(convertParamValue(params[p.getIndex()]));
+                list.add(convertParamValue(params[p.getIndex()], getParamAnnotations(m, p)));
             } else if (beanParamValues.containsKey(varName)) {
-                list.add(convertParamValue(beanParamValues.get(varName)));
+                list.add(convertParamValue(beanParamValues.get(varName), null));
             }
         }
         
@@ -426,7 +424,7 @@ public class ClientProxyImpl extends AbstractClient implements
                 for (Iterator<String> it = valuesMap.keySet().iterator(); it.hasNext();
index++) {
                     if (it.next().equals(p.getName()) && index < list.size())
{
                         list.remove(index);
-                        list.add(index, convertParamValue(params[p.getIndex()]));
+                        list.add(index, convertParamValue(params[p.getIndex()], null));
                         break;
                     }
                 }
@@ -435,6 +433,10 @@ public class ClientProxyImpl extends AbstractClient implements
         
         return list;
     }
+
+    private static Annotation[] getParamAnnotations(Method m, Parameter p) {
+        return m.getParameterAnnotations()[p.getIndex()];
+    }    
     
     @SuppressWarnings("unchecked")
     private static List<Parameter> getParameters(MultivaluedMap<ParameterType, Parameter>
map, 
@@ -442,21 +444,24 @@ public class ClientProxyImpl extends AbstractClient implements
         return  map.get(key) == null ? Collections.EMPTY_LIST : map.get(key);
     }
     
-    private void handleQueries(MultivaluedMap<ParameterType, Parameter> map,
-                               List<Parameter> beanParams,
+    private void handleQueries(Method m,
                                Object[] params,
+                               MultivaluedMap<ParameterType, Parameter> map,
+                               List<Parameter> beanParams,
                                UriBuilder ub) {
         List<Parameter> qs = getParameters(map, ParameterType.QUERY);
         for (Parameter p : qs) {
             if (params[p.getIndex()] != null) {
-                addMatrixQueryParamsToBuilder(ub, p.getName(), ParameterType.QUERY, params[p.getIndex()]);
+                addMatrixQueryParamsToBuilder(ub, p.getName(), ParameterType.QUERY,
+                                              getParamAnnotations(m, p), params[p.getIndex()]);
             }
         }
         for (Parameter p : beanParams) {
             Map<String, Object> values = getValuesFromBeanParam(params[p.getIndex()],
QueryParam.class);
             for (Map.Entry<String, Object> entry : values.entrySet()) {
                 if (entry.getValue() != null) {
-                    addMatrixQueryParamsToBuilder(ub, entry.getKey(), ParameterType.QUERY,
entry.getValue());
+                    addMatrixQueryParamsToBuilder(ub, entry.getKey(), ParameterType.QUERY,
+                                                  getParamAnnotations(m, p), entry.getValue());
                 }
             }
         }
@@ -482,21 +487,24 @@ public class ClientProxyImpl extends AbstractClient implements
         return values;
     }
     
-    private void handleMatrixes(MultivaluedMap<ParameterType, Parameter> map,
-                                List<Parameter> beanParams,
+    private void handleMatrixes(Method m,
                                 Object[] params,
+                                MultivaluedMap<ParameterType, Parameter> map,
+                                List<Parameter> beanParams,
                                 UriBuilder ub) {
         List<Parameter> mx = getParameters(map, ParameterType.MATRIX);
         for (Parameter p : mx) {
             if (params[p.getIndex()] != null) {
-                addMatrixQueryParamsToBuilder(ub, p.getName(), ParameterType.MATRIX, params[p.getIndex()]);
+                addMatrixQueryParamsToBuilder(ub, p.getName(), ParameterType.MATRIX, 
+                                              getParamAnnotations(m, p), params[p.getIndex()]);
             }
         }
         for (Parameter p : beanParams) {
             Map<String, Object> values = getValuesFromBeanParam(params[p.getIndex()],
MatrixParam.class);
             for (Map.Entry<String, Object> entry : values.entrySet()) {
                 if (entry.getValue() != null) {
-                    addMatrixQueryParamsToBuilder(ub, entry.getKey(), ParameterType.MATRIX,
entry.getValue());
+                    addMatrixQueryParamsToBuilder(ub, entry.getKey(), ParameterType.MATRIX,
+                                                  getParamAnnotations(m, p), entry.getValue());
                 }
             }
         }
@@ -528,10 +536,10 @@ public class ClientProxyImpl extends AbstractClient implements
                 Collection<?> c = pValue.getClass().isArray() 
                     ? Arrays.asList((Object[]) pValue) : (Collection<?>) pValue;
                 for (Iterator<?> it = c.iterator(); it.hasNext();) {
-                    FormUtils.addPropertyToForm(form, name, convertParamValue(it.next()));
+                    FormUtils.addPropertyToForm(form, name, convertParamValue(it.next(),
null));
                 }
             } else { 
-                FormUtils.addPropertyToForm(form, name, name.isEmpty() ? pValue : convertParamValue(pValue));

+                FormUtils.addPropertyToForm(form, name, name.isEmpty() ? pValue : convertParamValue(pValue,
null)); 
             }
             
         }
@@ -555,21 +563,23 @@ public class ClientProxyImpl extends AbstractClient implements
         return atts;        
     }
     
-    private void handleHeaders(MultivaluedMap<String, String> headers,
+    private void handleHeaders(Method m,
+                               Object[] params,
+                               MultivaluedMap<String, String> headers,
                                List<Parameter> beanParams,
-                               MultivaluedMap<ParameterType, Parameter> map, 
-                               Object[] params) {
+                               MultivaluedMap<ParameterType, Parameter> map) {
         List<Parameter> hs = getParameters(map, ParameterType.HEADER);
         for (Parameter p : hs) {
             if (params[p.getIndex()] != null) {
-                headers.add(p.getName(), convertParamValue(params[p.getIndex()]));
+                headers.add(p.getName(), convertParamValue(params[p.getIndex()], getParamAnnotations(m,
p)));
             }
         }
         for (Parameter p : beanParams) {
             Map<String, Object> values = getValuesFromBeanParam(params[p.getIndex()],
HeaderParam.class);
             for (Map.Entry<String, Object> entry : values.entrySet()) {
                 if (entry.getValue() != null) {
-                    headers.add(entry.getKey(), convertParamValue(entry.getValue()));
+                    headers.add(entry.getKey(), 
+                                convertParamValue(entry.getValue(), getParamAnnotations(m,
p)));
                 }
             }
         }
@@ -581,16 +591,17 @@ public class ClientProxyImpl extends AbstractClient implements
             aMethod.getParameterAnnotations()[index], Multipart.class) : null;
     }
     
-    private void handleCookies(MultivaluedMap<String, String> headers,
+    private void handleCookies(Method m,
+                               Object[] params, 
+                               MultivaluedMap<String, String> headers,
                                List<Parameter> beanParams,
-                               MultivaluedMap<ParameterType, Parameter> map, 
-                               Object[] params) {
+                               MultivaluedMap<ParameterType, Parameter> map) {
         List<Parameter> cs = getParameters(map, ParameterType.COOKIE);
         for (Parameter p : cs) {
             if (params[p.getIndex()] != null) {
                 headers.add(HttpHeaders.COOKIE, p.getName() 
                             + '=' 
-                            + convertParamValue(params[p.getIndex()].toString()));
+                            + convertParamValue(params[p.getIndex()].toString(), getParamAnnotations(m,
p)));
             }
         }
         for (Parameter p : beanParams) {
@@ -598,7 +609,8 @@ public class ClientProxyImpl extends AbstractClient implements
             for (Map.Entry<String, Object> entry : values.entrySet()) {
                 if (entry.getValue() != null) {
                     headers.add(HttpHeaders.COOKIE, 
-                                entry.getKey() + "=" +  convertParamValue(entry.getValue()));
+                                entry.getKey() + "=" 
+                                + convertParamValue(entry.getValue(), getParamAnnotations(m,
p)));
                 }
             }
         }

http://git-wip-us.apache.org/repos/asf/cxf/blob/d94e70f7/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/WebClient.java
----------------------------------------------------------------------
diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/WebClient.java b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/WebClient.java
index 7e2881c..224af56 100644
--- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/WebClient.java
+++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/WebClient.java
@@ -607,7 +607,7 @@ public class WebClient extends AbstractClient {
      * @return updated WebClient
      */
     public WebClient path(Object path) {
-        getCurrentBuilder().path(convertParamValue(path));
+        getCurrentBuilder().path(convertParamValue(path, null));
         
         return this;
     }
@@ -631,7 +631,7 @@ public class WebClient extends AbstractClient {
      * @return updated WebClient
      */
     public WebClient query(String name, Object ...values) {
-        addMatrixQueryParamsToBuilder(getCurrentBuilder(), name, ParameterType.QUERY, values);
+        addMatrixQueryParamsToBuilder(getCurrentBuilder(), name, ParameterType.QUERY, null,
values);
         return this;
     }
     
@@ -642,7 +642,7 @@ public class WebClient extends AbstractClient {
      * @return updated WebClient
      */
     public WebClient matrix(String name, Object ...values) {
-        addMatrixQueryParamsToBuilder(getCurrentBuilder(), name, ParameterType.MATRIX, values);
+        addMatrixQueryParamsToBuilder(getCurrentBuilder(), name, ParameterType.MATRIX, null,
values);
         return this;
     }
     

http://git-wip-us.apache.org/repos/asf/cxf/blob/d94e70f7/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 c2e36b3..8135a3d 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
@@ -383,18 +383,18 @@ public final class ProviderFactory {
         return (ExceptionMapper<T>) candidates.get(0);
     }
     
-    public <T> ParamConverter<T> createParameterHandler(Class<T> paramType)
{
+    public <T> ParamConverter<T> createParameterHandler(Class<T> paramType,
Annotation[] anns) {
         
         if (newParamConverter != null) {
-            return newParamConverter.getConverter(paramType, null, null);
+            anns = anns != null ? anns : new Annotation[]{};
+            return newParamConverter.getConverter(paramType, paramType, anns);
         } else if (legacyParamConverter != null) {
             return legacyParamConverter.getConverter(paramType, null, null);
         } else {
             return null;
         }
-        
     }
-    
+        
     @SuppressWarnings("unchecked")
     public <T extends Throwable> ResponseExceptionMapper<T> createResponseExceptionMapper(
                                  Class<?> paramType) {

http://git-wip-us.apache.org/repos/asf/cxf/blob/d94e70f7/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java
----------------------------------------------------------------------
diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java
b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java
index d8f3d89..3b0f3cc 100644
--- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java
+++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java
@@ -382,7 +382,7 @@ public final class InjectionUtils {
             adapterHasToBeUsed = true;
         }
         
-        Object result = instantiateFromParameterHandler(value, cls, message);
+        Object result = instantiateFromParameterHandler(value, cls, paramAnns, message);
         if (result != null) {
             return pClass.cast(result);
         }
@@ -395,7 +395,7 @@ public final class InjectionUtils {
         } catch (WebApplicationException ex) {
             throw ex;
         } catch (Exception ex) {
-            result = createFromParameterHandler(value, cls, message);
+            result = createFromParameterHandler(value, cls, paramAnns, message);
             if (result == null) {
                 LOG.severe(new org.apache.cxf.common.i18n.Message("CLASS_CONSTRUCTOR_FAILURE",

                                                                    BUNDLE, 
@@ -418,7 +418,7 @@ public final class InjectionUtils {
         }
         
         if (result == null) {
-            result = createFromParameterHandler(value, cls, message);
+            result = createFromParameterHandler(value, cls, paramAnns, message);
         }
         
         if (adapterHasToBeUsed) {
@@ -440,10 +440,11 @@ public final class InjectionUtils {
 
     private static <T> T instantiateFromParameterHandler(String value, 
                                                      Class<T> pClass,
+                                                     Annotation[] anns,  
                                                      Message m) {
         if (Date.class == pClass || Locale.class == pClass 
             || m != null && MessageUtils.isTrue(m.getContextualProperty(PARAM_HANDLERS_FIRST)))
{
-            return createFromParameterHandler(value, pClass, m);
+            return createFromParameterHandler(value, pClass, anns, m);
         } else {
             return null;
         }
@@ -451,11 +452,12 @@ public final class InjectionUtils {
     
     private static <T> T createFromParameterHandler(String value, 
                                                     Class<T> pClass,
+                                                    Annotation[] anns,
                                                     Message message) {
         T result = null;
         if (message != null) {
             ParamConverter<T> pm = ProviderFactory.getInstance(message)
-                .createParameterHandler(pClass);
+                .createParameterHandler(pClass, anns);
             if (pm != null) {
                 result = pm.fromString(value);
             }

http://git-wip-us.apache.org/repos/asf/cxf/blob/d94e70f7/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/ProviderFactoryTest.java
----------------------------------------------------------------------
diff --git a/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/ProviderFactoryTest.java
b/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/ProviderFactoryTest.java
index 12943e0..1a5930b 100644
--- a/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/ProviderFactoryTest.java
+++ b/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/ProviderFactoryTest.java
@@ -420,7 +420,7 @@ public class ProviderFactoryTest extends Assert {
         ProviderFactory pf = ProviderFactory.getInstance();
         ParameterHandler<Customer> h = new CustomerParameterHandler();
         pf.registerUserProvider(h);
-        ParamConverter<Customer> h2 = pf.createParameterHandler(Customer.class);
+        ParamConverter<Customer> h2 = pf.createParameterHandler(Customer.class, null);
         
         assertSame(((LegacyParamConverter<Customer>)h2).getHandler(), h);
     }


Mime
View raw message