Hi I used the below sample with java 1.6 which is working fine and returning 200 as response but in case I use java 1.3 , I am getting response 407.
My Class:
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Properties;
public class Class1 {
public static void main(String[] args) {
String url = "http://www.google.com/",
proxy = "myproxyserver",
port = "myport";
URL server = null;
try {
Properties systemProperties = System.getProperties();
systemProperties.setProperty("http.proxyHost", proxy);
systemProperties.setProperty("http.proxyPort", port);
} catch (Exception e) {
e.printStackTrace();
}
try {
server = new URL(url);
} catch (MalformedURLException e2) {
// TODO Auto-generated catch block
e2.printStackTrace();
}
HttpURLConnection connection = null;
try {
connection = (HttpURLConnection) server.openConnection();
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
try {
connection.connect();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
InputStream in = connection.getInputStream();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
System.out.println(connection.getResponseCode());
System.out.println("done");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
what I am doing wrong or what I need to do for it to work with java1.3 ?
please help.