File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Sockets and Internet Protocols and the fly likes HttpsURLConnection Proxy auth problem Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Reply Bookmark "HttpsURLConnection Proxy auth problem" Watch "HttpsURLConnection Proxy auth problem" New topic
Author

HttpsURLConnection Proxy auth problem

Andreas Niemeyeer
Greenhorn

Joined: Dec 13, 2005
Posts: 2
Dear all,

I want to do a https request with an proxy and authorisation.

Here an example code and values (the user/pass is correct):

String vProxy = "localproxy";
String vProxyPort = "80";
String vProxyUser = "user";
String vProxyPass = "pass";
System.setProperty("https.proxyHost", vProxy);
System.setProperty("https.proxyPort", vProxyPort);

URL vURL = new URL("https://www.google.com:443/");
HttpsURLConnection vCon = (HttpsURLConnection) vURL.openConnection();
String vAccount = vProxyUser + ":" + vProxyPass;
String vEncodedAccount = new sun.misc.BASE64Encoder().encode(vAccount.getBytes());
vCon.setRequestProperty("Https-Proxy-Authorization", "Basic "+encodedAuth);

vResponseCode = vCon.getResponseCode();
vResponseMessage = vCon.getResponseMessage();


The response message is always `Proxy Authentication Required'.

Has anyone the same problem solved? Might it be a digest auth scheme or another thing?


Thank you in advance,
Andreas
Andreas Niemeyer
Greenhorn

Joined: Dec 13, 2005
Posts: 4
Dear all,

I solved the problem by reading this thread:

https://cis.med.ucalgary.ca/http/forum.java.sun.com/thread.jspa?threadID=188930&tstart=45

and use now this great package:

http://jakarta.apache.org/commons/httpclient

:-)

Thanks for your attention,
Andreas
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: HttpsURLConnection Proxy auth problem
 
Similar Threads
Https url connection ArrayIndeoutofBounds Exception java
ArrayIndexOutOfBoundsException
HttpsURLConnection - Problem in SSL Handshaking
going mad about HttpsURLConnection
client using https url