Problem With Proxy Server Access
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Jojo_Paderes
Posted On:   Sunday, September 29, 2002 10:10 PM

I'm looking for a good reference source or some advice on how to configure stand-alone Java applications for Proxy Server access to a https site. Currently I'm having some difficulties setting up the Java https system properties for proxy server authentication (username and password). Here's a sample Java command line I'm using to set the system properties for proxy server access:


java -DproxySet=true -Dhttps.proxyHost=192.168.0.1 -Dhttps.proxyPort=3128 HelloProxyServer


Any recommendations or tips? Thanks in advance!

Re: Problem With Proxy Server Access

Posted By:   Christopher_Dean  
Posted On:   Thursday, October 31, 2002 07:26 AM

I don't know if this will help or not since they problem may be with HTTPS (and this is a whole other beast). I know you have to send a CONNECT header first before any other traffic and then setup an authenticator in your java app.

Apparently, java expects you to set up one authenticator for all proxy connections (as opposed to setting something in the HTTPUrlConnection clas which seems more logical to me).

To Do this create:


public class MyAuthenticator extends Authenticator
{
protected PasswordAuthentication
getPasswordAuthentication()
{
return new PasswordAuthentication
("username","password".toCharArray());
}
}

Somewhere in your startup place:



Authenticator.setDefault(new MyAuthenticator());


I hope this is what you were asking for.
About | Sitemap | Contact