Return-Path: X-Original-To: apmail-cxf-commits-archive@www.apache.org Delivered-To: apmail-cxf-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id ADD7B17602 for ; Mon, 20 Apr 2015 11:39:49 +0000 (UTC) Received: (qmail 46953 invoked by uid 500); 20 Apr 2015 11:39:49 -0000 Delivered-To: apmail-cxf-commits-archive@cxf.apache.org Received: (qmail 46887 invoked by uid 500); 20 Apr 2015 11:39:49 -0000 Mailing-List: contact commits-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list commits@cxf.apache.org Received: (qmail 46874 invoked by uid 99); 20 Apr 2015 11:39:49 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 20 Apr 2015 11:39:49 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 3FC6AE04E5; Mon, 20 Apr 2015 11:39:49 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: sergeyb@apache.org To: commits@cxf.apache.org Date: Mon, 20 Apr 2015 11:39:49 -0000 Message-Id: <72b2c545b88b489e8bd9a5868ab2bcee@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [1/2] cxf git commit: [CXF-6353] Support for HTTP proxy properties Repository: cxf Updated Branches: refs/heads/3.0.x-fixes 646424838 -> 1731258de [CXF-6353] Support for HTTP proxy properties Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/f3eaa61a Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/f3eaa61a Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/f3eaa61a Branch: refs/heads/3.0.x-fixes Commit: f3eaa61a2ac9c9a22b31519bbe0dc92f9cf84219 Parents: 6464248 Author: Sergey Beryozkin Authored: Fri Apr 17 17:29:28 2015 +0100 Committer: Sergey Beryozkin Committed: Fri Apr 17 17:30:49 2015 +0100 ---------------------------------------------------------------------- .../cxf/jaxrs/client/spec/ClientImpl.java | 30 ++++++++++++++++---- 1 file changed, 24 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cxf/blob/f3eaa61a/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/spec/ClientImpl.java ---------------------------------------------------------------------- diff --git a/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/spec/ClientImpl.java b/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/spec/ClientImpl.java index 95c7650..f19a32f 100644 --- a/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/spec/ClientImpl.java +++ b/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/spec/ClientImpl.java @@ -50,6 +50,8 @@ import org.apache.cxf.transport.https.SSLUtils; public class ClientImpl implements Client { private static final String HTTP_CONNECTION_TIMEOUT_PROP = "http.connection.timeout"; private static final String HTTP_RECEIVE_TIMEOUT_PROP = "http.receive.timeout"; + private static final String HTTP_PROXY_SERVER_PROP = "http.proxy.server.uri"; + private static final String HTTP_PROXY_SERVER_PORT_PROP = "http.proxy.server.port"; private Configurable configImpl; private TLSConfiguration secConfig; @@ -271,6 +273,13 @@ public class ClientImpl implements Client { || tlsParams.getTrustManagers() != null) { clientCfg.getHttpConduit().setTlsClientParameters(tlsParams); } + + setConnectionProperties(configProps, clientCfg); + + // start building the invocation + return new InvocationBuilderImpl(WebClient.fromClient(targetClient)); + } + private void setConnectionProperties(Map configProps, ClientConfiguration clientCfg) { Long connTimeOutValue = getLongValue(configProps.get(HTTP_CONNECTION_TIMEOUT_PROP)); if (connTimeOutValue != null) { clientCfg.getHttpConduit().getClient().setConnectionTimeout(connTimeOutValue); @@ -279,13 +288,16 @@ public class ClientImpl implements Client { if (recTimeOutValue != null) { clientCfg.getHttpConduit().getClient().setReceiveTimeout(recTimeOutValue); } - - // start building the invocation - return new InvocationBuilderImpl(WebClient.fromClient(targetClient)); - } - private Long getLongValue(Object o) { - return o instanceof Long ? (Long)o : o instanceof String ? Long.valueOf(o.toString()) : null; + Object proxyServerValue = configProps.get(HTTP_PROXY_SERVER_PROP); + if (proxyServerValue != null) { + clientCfg.getHttpConduit().getClient().setProxyServer((String)proxyServerValue); + } + Integer proxyServerPortValue = getIntValue(configProps.get(HTTP_PROXY_SERVER_PORT_PROP)); + if (proxyServerPortValue != null) { + clientCfg.getHttpConduit().getClient().setProxyServerPort(proxyServerPortValue); + } } + private void initTargetClientIfNeeded() { URI uri = uriBuilder.build(); if (targetClient == null) { @@ -483,4 +495,10 @@ public class ClientImpl implements Client { checkNull(templatesMap.values().toArray()); } } + private static Long getLongValue(Object o) { + return o instanceof Long ? (Long)o : o instanceof String ? Long.valueOf(o.toString()) : null; + } + private static Integer getIntValue(Object o) { + return o instanceof Integer ? (Integer)o : o instanceof String ? Integer.valueOf(o.toString()) : null; + } }