0

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.

iAmLearning
  • 1,153
  • 3
  • 15
  • 28
  • Have you tried the other options from [these answers](http://stackoverflow.com/q/4599933/1225328)? – sp00m Apr 16 '14 at 14:24
  • I believe the properties name changed at some time. Have you tried with `proxyHost` and `proxyPort` (e.g. without the `http.` prefix) under Java 1.3? – Bruno Grieder Apr 16 '14 at 16:00

0 Answers0