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] Update for form parameters
Date Wed, 05 Mar 2014 14:12:21 GMT
Repository: cxf
Updated Branches:
  refs/heads/2.7.x-fixes d94e70f71 -> d60d7c2cb


[CXF-5593] Update for form parameters


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

Branch: refs/heads/2.7.x-fixes
Commit: d60d7c2cbc73d738a37b509c3962a2a64964f767
Parents: d94e70f
Author: Sergey Beryozkin <sberyozkin@talend.com>
Authored: Wed Mar 5 13:44:52 2014 +0000
Committer: Sergey Beryozkin <sberyozkin@talend.com>
Committed: Wed Mar 5 14:11:42 2014 +0000

----------------------------------------------------------------------
 .../cxf/jaxrs/client/ClientProxyImpl.java       | 24 +++++++++++---------
 1 file changed, 13 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/d60d7c2c/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 abd5a56..7dd2ca5 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
@@ -211,7 +211,7 @@ public class ClientProxyImpl extends AbstractClient implements
         if (bodyIndex != -1) {
             body = params[bodyIndex];
         } else if (types.containsKey(ParameterType.FORM))  {
-            body = handleForm(types, beanParamsList, params);
+            body = handleForm(m, params, types, beanParamsList);
         } else if (types.containsKey(ParameterType.REQUEST_BODY))  {
             body = handleMultipart(types, ori, params);
         }
@@ -461,7 +461,7 @@ public class ClientProxyImpl extends AbstractClient implements
             for (Map.Entry<String, Object> entry : values.entrySet()) {
                 if (entry.getValue() != null) {
                     addMatrixQueryParamsToBuilder(ub, entry.getKey(), ParameterType.QUERY,
-                                                  getParamAnnotations(m, p), entry.getValue());
+                                                  null, entry.getValue());
                 }
             }
         }
@@ -504,42 +504,44 @@ public class ClientProxyImpl extends AbstractClient implements
             for (Map.Entry<String, Object> entry : values.entrySet()) {
                 if (entry.getValue() != null) {
                     addMatrixQueryParamsToBuilder(ub, entry.getKey(), ParameterType.MATRIX,
-                                                  getParamAnnotations(m, p), entry.getValue());
+                                                  null, entry.getValue());
                 }
             }
         }
     }
 
-    private MultivaluedMap<String, String> handleForm(MultivaluedMap<ParameterType,
Parameter> map, 
-                                                      List<Parameter> beanParams,
-                                                      Object[] params) {
+    private MultivaluedMap<String, String> handleForm(Method m,
+                                                      Object[] params, 
+                                                      MultivaluedMap<ParameterType, Parameter>
map, 
+                                                      List<Parameter> beanParams) {
         
         MultivaluedMap<String, String> form = new MetadataMap<String, String>();
         
         List<Parameter> fm = getParameters(map, ParameterType.FORM);
         for (Parameter p : fm) {
-            addFormValue(form, p.getName(), params[p.getIndex()]);
+            addFormValue(form, p.getName(), params[p.getIndex()], getParamAnnotations(m,
p));
         }
         for (Parameter p : beanParams) {
             Map<String, Object> values = getValuesFromBeanParam(params[p.getIndex()],
FormParam.class);
             for (Map.Entry<String, Object> entry : values.entrySet()) {
-                addFormValue(form, entry.getKey(), entry.getValue());
+                addFormValue(form, entry.getKey(), entry.getValue(), null);
             }
         }
         
         return form;
     }
     
-    private void addFormValue(MultivaluedMap<String, String> form, String name, Object
pValue) {
+    private void addFormValue(MultivaluedMap<String, String> form, String name,
+                              Object pValue, Annotation[] anns) {
         if (pValue != null) {
             if (InjectionUtils.isSupportedCollectionOrArray(pValue.getClass())) {
                 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(),
null));
+                    FormUtils.addPropertyToForm(form, name, convertParamValue(it.next(),
anns));
                 }
             } else { 
-                FormUtils.addPropertyToForm(form, name, name.isEmpty() ? pValue : convertParamValue(pValue,
null)); 
+                FormUtils.addPropertyToForm(form, name, name.isEmpty() ? pValue : convertParamValue(pValue,
anns)); 
             }
             
         }


Mime
View raw message