Repository: cxf Updated Branches: refs/heads/master 47192c083 -> c886dc72f
[CXF-7448] Use reflection by default for HttpURLConnection request methods Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/c886dc72 Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/c886dc72 Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/c886dc72 Branch: refs/heads/master Commit: c886dc72fc4d714e9a28f17a1adbd641eaa5744e Parents: 47192c0 Author: Andy McCright <[email protected]> Authored: Mon Jul 17 16:03:56 2017 -0500 Committer: Andy McCright <[email protected]> Committed: Thu Aug 24 13:22:59 2017 -0500 ---------------------------------------------------------------------- .../apache/cxf/jaxrs/client/AbstractClient.java | 25 ++++++++++++-------- 1 file changed, 15 insertions(+), 10 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cxf/blob/c886dc72/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/AbstractClient.java ---------------------------------------------------------------------- diff --git a/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/AbstractClient.java b/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/AbstractClient.java index 7b534b6..c012c6b 100644 --- a/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/AbstractClient.java +++ b/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/AbstractClient.java @@ -133,7 +133,7 @@ public abstract class AbstractClient implements Client { /** * {@inheritDoc} */ - public Client query(String name, Object ...values) { + public Client query(String name, Object...values) { addMatrixQueryParamsToBuilder(getCurrentBuilder(), name, ParameterType.QUERY, null, values); return this; } @@ -1012,15 +1012,20 @@ public abstract class AbstractClient implements Client { private void setRequestMethod(Message m, String httpMethod) { m.put(Message.HTTP_REQUEST_METHOD, httpMethod); - if (!KNOWN_METHODS.contains(httpMethod) && !m.containsKey("use.async.http.conduit")) { - // if the async conduit is loaded then let it handle this method without users - // having to explicitly request it given that, without reflectively updating - // HTTPUrlConnection, it will not work without the async conduit anyway - m.put("use.async.http.conduit", true); - } - //TODO: consider setting "use.httpurlconnection.method.reflection" here too - - // if the async conduit is not loaded then the only way for the custom HTTP verb - // to be supported is to attempt to reflectively modify HTTPUrlConnection + if (!KNOWN_METHODS.contains(httpMethod)) { + if (!m.containsKey("use.async.http.conduit")) { + // if the async conduit is loaded then let it handle this method without users + // having to explicitly request it given that, without reflectively updating + // HTTPUrlConnection, it will not work without the async conduit anyway + m.put("use.async.http.conduit", true); + } + + if (!m.containsKey("use.httpurlconnection.method.reflection")) { + // if the async conduit is not loaded then the only way for the custom HTTP verb + // to be supported is to attempt to reflectively modify HTTPUrlConnection + m.put("use.httpurlconnection.method.reflection", true); + } + } } protected void setEmptyRequestPropertyIfNeeded(Message outMessage, Object body) {
