viruthachalam arunachalam

Greenhorn
+ Follow
since Jun 29, 2007
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 viruthachalam arunachalam

i have replaced the fuction with
SocketAddress addr = new InetSocketAddress(proxyadd,port);
Proxy proxy = new Proxy(Proxy.Type.HTTP, addr);
URLConnection connection = url.openConnection(proxy);
its working now. thanks.
The piece of code works fine in my home.But when iam using this code in my office by setting the proxy settings it throwing error as below.
error
-------
java.net.UnknownHostException: proxynt.pune.gsslco.co.in
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:177)
at java.net.Socket.connect(Socket.java:519)
at java.net.Socket.connect(Socket.java:469)
at sun.net.NetworkClient.doConnect(NetworkClient.java:157)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:388)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:500)
at sun.net.www.http.HttpClient.<init>(HttpClient.java:233)
at sun.net.www.http.HttpClient.New(HttpClient.java:306)
at sun.net.www.http.HttpClient.New(HttpClient.java:318)
at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:792)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:733)
at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:658)
at javaapplication6.NewMain.connectnet(NewMain.java:59)
at javaapplication6.NewMain.main(NewMain.java:105)
---------------

code


System.setProperty("https.proxyHost", "19.27.24.13");
System.setProperty("https.proxyPort", "83");
try
{
String urlName="http://proxynt.pune.gsslco.co.in:7890/intranet/finance/Annual_reports/annual_report_2000.pdf";
URL url = new URL(urlName);
File dat = new File("data.pdf");
FileOutputStream datStream = new FileOutputStream(dat);
URLConnection connection = url.openConnection();
String input = "username"+ ":" + "passord";
String encoding = new sun.misc.BASE64Encoder().encode (input.getBytes());

connection.setRequestProperty("Authorization", "Basic " + encoding);
connection.setDoOutput(true);
connection.connect();
-----------------------------------
[ July 02, 2007: Message edited by: viruthachalam arunachalam ]
I need to connect to a proxy server which asks for the authentication for
user id and password through a pop up window.After authentication we could log in to the website.can anyone help how to login to this website and download a file using Java.
I would appreciate if anyone can guide me in doing this