Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLConnection;

public class Main {
    public static void main(String[] argv) throws Exception {
        HttpURLConnection.setFollowRedirects(false);

        URL url = new URL("http://hostname:80");
        URLConnection conn = url.openConnection();

        HttpURLConnection httpConn = (HttpURLConnection) conn;
        httpConn.setInstanceFollowRedirects(false);

        conn.connect();
    }
}