cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject cxf git commit: Making all of JAX-RS proxy parameters available to the interceptor chain
Date Mon, 14 Nov 2016 11:59:41 GMT
Repository: cxf
Updated Branches:
  refs/heads/3.0.x-fixes f3cba4054 -> 9a0403a56


Making all of JAX-RS proxy parameters available to the interceptor chain


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

Branch: refs/heads/3.0.x-fixes
Commit: 9a0403a56e779dcf55b184397ab3383d34c37193
Parents: f3cba40
Author: Sergey Beryozkin <sberyozkin@gmail.com>
Authored: Mon Nov 14 11:50:56 2016 +0000
Committer: Sergey Beryozkin <sberyozkin@gmail.com>
Committed: Mon Nov 14 11:59:26 2016 +0000

----------------------------------------------------------------------
 .../apache/cxf/jaxrs/client/ClientProxyImpl.java | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/9a0403a5/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/ClientProxyImpl.java
----------------------------------------------------------------------
diff --git a/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/ClientProxyImpl.java b/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/ClientProxyImpl.java
index 27a626a..989dcea 100644
--- a/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/ClientProxyImpl.java
+++ b/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/ClientProxyImpl.java
@@ -94,6 +94,8 @@ public class ClientProxyImpl extends AbstractClient implements
     private static final ResourceBundle BUNDLE = BundleUtils.getBundle(ClientProxyImpl.class);
     private static final String SLASH = "/";
     private static final String BUFFER_PROXY_RESPONSE = "buffer.proxy.response";
+    private static final String METHOD_PARAM_BODY_INDEX = "method.parameter.body.index";
+    private static final String METHOD_PARAMS = "method.parameters";
     
     private ClassResourceInfo cri;
     private ClassLoader proxyLoader;
@@ -225,7 +227,7 @@ public class ClientProxyImpl extends AbstractClient implements
             body == null ? null : body.getClass(), m.getReturnType());
         
         
-        return doChainedInvocation(uri, headers, ori, body, bodyIndex, null, null);
+        return doChainedInvocation(uri, headers, ori, params, body, bodyIndex, null, null);
         
     }
 
@@ -709,14 +711,16 @@ public class ClientProxyImpl extends AbstractClient implements
             }
         }
     }
-    
+    //CHECKSTYLE:OFF
     private Object doChainedInvocation(URI uri, 
                                        MultivaluedMap<String, String> headers, 
                                        OperationResourceInfo ori, 
+                                       Object[] methodParams,
                                        Object body, 
                                        int bodyIndex,
                                        Exchange exchange,
                                        Map<String, Object> invocationContext) throws
Throwable {
+    //CHECKSTYLE:ON    
         Bus configuredBus = getConfiguration().getBus();
         Bus origBus = BusFactory.getAndSetThreadDefaultBus(configuredBus);
         ClassLoaderHolder origLoader = null;
@@ -739,14 +743,15 @@ public class ClientProxyImpl extends AbstractClient implements
             outMessage.put(Annotation.class.getName(), 
                            getMethodAnnotations(ori.getAnnotatedMethod(), bodyIndex));
             
+            outMessage.put(METHOD_PARAMS, methodParams);
             if (body != null) {
-                outMessage.put("BODY_INDEX", bodyIndex);
+                outMessage.put(METHOD_PARAM_BODY_INDEX, bodyIndex);
             }
             outMessage.getInterceptorChain().add(bodyWriter);
             
             Map<String, Object> reqContext = getRequestContext(outMessage);
             reqContext.put(OperationResourceInfo.class.getName(), ori);
-            reqContext.put("BODY_INDEX", bodyIndex);
+            reqContext.put(METHOD_PARAM_BODY_INDEX, bodyIndex);
             
             // execute chain    
             doRunInterceptorChain(outMessage);
@@ -780,10 +785,10 @@ public class ClientProxyImpl extends AbstractClient implements
                                  Map<String, Object> invContext) throws Throwable {
         
         Map<String, Object> reqContext = CastUtils.cast((Map<?, ?>)invContext.get(REQUEST_CONTEXT));
-        int bodyIndex = body != null ? (Integer)reqContext.get("BODY_INDEX") : -1;
+        int bodyIndex = body != null ? (Integer)reqContext.get(METHOD_PARAM_BODY_INDEX) :
-1;
         OperationResourceInfo ori = 
             (OperationResourceInfo)reqContext.get(OperationResourceInfo.class.getName());
-        return doChainedInvocation(newRequestURI, headers, ori, 
+        return doChainedInvocation(newRequestURI, headers, ori, null,
                                    body, bodyIndex, exchange, invContext);
     }
     
@@ -858,7 +863,7 @@ public class ClientProxyImpl extends AbstractClient implements
             }
             
             Method method = ori.getMethodToInvoke();
-            int bodyIndex = (Integer)outMessage.get("BODY_INDEX");
+            int bodyIndex = (Integer)outMessage.get(METHOD_PARAM_BODY_INDEX);
             
             Annotation[] anns = customAnns != null ? customAnns
                 : getMethodAnnotations(ori.getAnnotatedMethod(), bodyIndex);


Mime
View raw message