Author: thomas.heute(a)jboss.com
Date: 2008-06-04 09:35:16 -0400 (Wed, 04 Jun 2008)
New Revision: 10919
Modified:
modules/common/branches/JBP_COMMON_BRANCH_1_1/common/src/main/java/org/jboss/portal/common/net/URLTools.java
Log:
use http.proxyUser and http.proxyPassword for authentication
Modified:
modules/common/branches/JBP_COMMON_BRANCH_1_1/common/src/main/java/org/jboss/portal/common/net/URLTools.java
===================================================================
---
modules/common/branches/JBP_COMMON_BRANCH_1_1/common/src/main/java/org/jboss/portal/common/net/URLTools.java 2008-06-04
13:17:50 UTC (rev 10918)
+++
modules/common/branches/JBP_COMMON_BRANCH_1_1/common/src/main/java/org/jboss/portal/common/net/URLTools.java 2008-06-04
13:35:16 UTC (rev 10919)
@@ -31,7 +31,9 @@
import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
+import java.net.Authenticator;
import java.net.MalformedURLException;
+import java.net.PasswordAuthentication;
import java.net.SocketTimeoutException;
import java.net.URL;
import java.net.URLConnection;
@@ -118,6 +120,17 @@
throw new IllegalArgumentException("No negative connection timeout" +
connTimeoutMillis);
}
+ if (System.getProperty("http.proxyUser") != null)
+ {
+ Authenticator.setDefault(new Authenticator(){
+
+ protected PasswordAuthentication getPasswordAuthentication()
+ {
+ return (new
PasswordAuthentication(System.getProperty("http.proxyUser"),
System.getProperty("http.proxyPassword").toCharArray()));
+ }
+ });
+ }
+
//
URLConnection conn;
try
Show replies by date