Anshumn Sagar

Greenhorn
+ Follow
since Jun 20, 2001
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Anshumn Sagar

Hi Lars,
I was trying the same as "username assword";. It is not working. Now I specified the charater set as ("US-ASCII") also, but still it is not crossing the proxy. I am not able to figure out what can be the problem. Please let me know if any other alternative is there.
Thanks for the help..
Anshumn

Originally posted by Lars J. Nilsson:
Hello,
Correct me if I'm wrong. It might be as simple as:
String password = "username assword";

Or if that does not work, try to encode your string to bytes using a character set. Default set might not be what you want:
String encodedPassword = new sun.misc.BASE64Encoder().encode( password.getBytes("US-ASCII") );

Java handles HTTPS through the package JSSE which you'll find here:
http://java.sun.com/products/jsse/

Yours
- Lars


Hi,
I have two doubts :
1. I am trying to connect to some site using URLConnection. But I am behind a proxy. How can I do it to connect to that site? In my code I use the following to cross proxy :
System.getProperties().put( "proxySet", "true" );
System.getProperties().put( "proxyHost", "my proxy ip" );
System.getProperties().put( "proxyPort", "8080" );
String password = "username assword";
String encodedPassword = "Base " + new sun.misc.BASE64Encoder().encode( password.getBytes() );
URL url = new URL("http://www.rediff.com");
URLConnection urlConnection = url.openConnection();
urlConnection.setRequestProperty( "Proxy-Authorization", encodedPassword );
urlConnection.setDoOutput(true);
But it does not cross the proxy. Am I doing something wrong in the above piece of code ? Any other way to do it ??
2. Is it possible in JDK 1.1 to make a HTTPS connection ? In the above code I tried, but I get error saying that the protocol is not recognised. Is there any way to do it using jdk 1.1 ?
If not then, any new version of jdk supports HTTPS connection ?
Please give your valuable inputs on the same.
Any help in this shall be highly very helpful for me.
Thanks in advance,
Anshumn