You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by ff...@apache.org on 2007/05/23 05:48:17 UTC
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
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) {