Return-Path: Delivered-To: apmail-incubator-cxf-commits-archive@locus.apache.org Received: (qmail 25150 invoked from network); 23 May 2007 03:48:39 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 23 May 2007 03:48:39 -0000 Received: (qmail 96605 invoked by uid 500); 23 May 2007 03:48:44 -0000 Delivered-To: apmail-incubator-cxf-commits-archive@incubator.apache.org Received: (qmail 96543 invoked by uid 500); 23 May 2007 03:48:44 -0000 Mailing-List: contact cxf-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: cxf-dev@incubator.apache.org Delivered-To: mailing list cxf-commits@incubator.apache.org Received: (qmail 96532 invoked by uid 99); 23 May 2007 03:48:44 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 22 May 2007 20:48:44 -0700 X-ASF-Spam-Status: No, hits=-99.5 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 22 May 2007 20:48:37 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id 8EFC41A981A; Tue, 22 May 2007 20:48:17 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r540831 - in /incubator/cxf/trunk: common/common/src/main/java/org/apache/cxf/resource/URIResolver.java rt/core/src/main/java/org/apache/cxf/attachment/AttachmentUtil.java Date: Wed, 23 May 2007 03:48:17 -0000 To: cxf-commits@incubator.apache.org From: ffang@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20070523034817.8EFC41A981A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: ffang Date: Tue May 22 20:48:16 2007 New Revision: 540831 URL: http://svn.apache.org/viewvc?view=rev&rev=540831 Log: [CXF-596] apply patch provided by Chris Moesel [CXF-618] apply patch provided by Guillaume Alleon Modified: incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/resource/URIResolver.java incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/attachment/AttachmentUtil.java Modified: incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/resource/URIResolver.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/resource/URIResolver.java?view=diff&rev=540831&r1=540830&r2=540831 ============================================================================== --- incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/resource/URIResolver.java (original) +++ incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/resource/URIResolver.java Tue May 22 20:48:16 2007 @@ -23,12 +23,14 @@ import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; +import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.URI; import java.net.URISyntaxException; import java.net.URL; import org.apache.cxf.common.classloader.ClassLoaderUtils; +import org.apache.cxf.common.util.Base64Utility; /** * Resolves a File, classpath resource, or URL according to the follow rules: @@ -76,6 +78,7 @@ this.calling = (callingCls != null) ? callingCls : getClass(); this.file = null; this.uri = null; + this.is = null; if (uriStr.startsWith("classpath:")) { @@ -106,7 +109,31 @@ if (relative.isAbsolute()) { uri = relative; url = relative.toURL(); - is = url.openStream(); + + try { + HttpURLConnection huc = (HttpURLConnection)url.openConnection(); + + String host = System.getProperty("http.proxyHost"); + if (host != null) { + //comment out unused port to pass pmd check + /*String ports = System.getProperty("http.proxyPort"); + int port = 80; + if (ports != null) { + port = Integer.parseInt(ports); + }*/ + + String username = System.getProperty("http.proxy.user"); + String password = System.getProperty("http.proxy.password"); + + if (username != null && password != null) { + String encoded = Base64Utility.encode((username + ":" + password).getBytes()); + huc.setRequestProperty("Proxy-Authorization", "Basic " + encoded); + } + } + is = huc.getInputStream(); + } catch (ClassCastException ex) { + is = url.openStream(); + } } else if (baseUriStr != null) { URI base; File baseFile = new File(baseUriStr); Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/attachment/AttachmentUtil.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/attachment/AttachmentUtil.java?view=diff&rev=540831&r1=540830&r2=540831 ============================================================================== --- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/attachment/AttachmentUtil.java (original) +++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/attachment/AttachmentUtil.java Tue May 22 20:48:16 2007 @@ -42,7 +42,7 @@ public static String createContentID(String ns) throws UnsupportedEncodingException { // tend to change String cid = "http://cxf.apache.org/"; - String name = UUID.randomUUID() + "@"; + String name = UUID.randomUUID().toString(); if (ns != null && (ns.length() > 0)) { try { URI uri = new URI(ns); @@ -52,10 +52,10 @@ e.printStackTrace(); return null; } catch (MalformedURLException e) { - cid = URLEncoder.encode(ns, "UTF-8"); + cid = ns; } } - return URLEncoder.encode(name + cid, "UTF-8"); + return URLEncoder.encode(name, "UTF-8") + "@" + URLEncoder.encode(cid, "UTF-8"); } public static String getUniqueBoundaryValue(int part) {