Compare URL
In this chapter you will learn:
URL Equality
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLConnection;
// j av a2s . c o m
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();
}
}
The code above generates the following result.
Next chapter...
What you will learn in the next chapter:
Home » Java Tutorial » URL URI