List of usage examples for java.net URL URL
public URL(String spec) throws MalformedURLException
From source file:Main.java
public static void main(String[] argv) throws Exception { HttpURLConnection.setFollowRedirects(false); HttpURLConnection con = (HttpURLConnection) new URL("http://www.google.coom").openConnection(); con.setRequestMethod("HEAD"); System.out.println(con.getResponseCode() == HttpURLConnection.HTTP_NOT_IMPLEMENTED); }
From source file:Main.java
public static void main(String[] argv) throws Exception { HttpURLConnection.setFollowRedirects(false); HttpURLConnection con = (HttpURLConnection) new URL("http://www.google.coom").openConnection(); con.setRequestMethod("HEAD"); System.out.println(con.getResponseCode() == HttpURLConnection.HTTP_MULT_CHOICE); }
From source file:Main.java
public static void main(String[] argv) throws Exception { HttpURLConnection.setFollowRedirects(false); HttpURLConnection con = (HttpURLConnection) new URL("http://www.google.coom").openConnection(); con.setRequestMethod("HEAD"); System.out.println(con.getResponseCode() == HttpURLConnection.HTTP_NOT_FOUND); }
From source file:Main.java
public static void main(String[] argv) throws Exception { HttpURLConnection.setFollowRedirects(false); HttpURLConnection con = (HttpURLConnection) new URL("http://www.google.coom").openConnection(); con.setRequestMethod("HEAD"); System.out.println(con.getResponseCode() == HttpURLConnection.HTTP_NOT_MODIFIED); }
From source file:Main.java
public static void main(String[] argv) throws Exception { HttpURLConnection.setFollowRedirects(false); HttpURLConnection con = (HttpURLConnection) new URL("http://www.google.coom").openConnection(); con.setRequestMethod("HEAD"); System.out.println(con.getResponseCode() == HttpURLConnection.HTTP_NOT_ACCEPTABLE); }
From source file:Main.java
public static void main(String[] args) throws Exception { ImageIcon icon = new ImageIcon(new URL("http://www.java2s.com/style/download.png")); UIManager.put("OptionPane.informationIcon", icon); JOptionPane.showMessageDialog(null, "Hello!"); }
From source file:Main.java
public static void main(String[] argv) throws Exception { HttpURLConnection.setFollowRedirects(false); HttpURLConnection con = (HttpURLConnection) new URL("http://www.google.coom").openConnection(); con.setRequestMethod("HEAD"); System.out.println(con.getResponseCode() == HttpURLConnection.HTTP_NO_CONTENT); }
From source file:Main.java
public static void main(String[] argv) throws Exception { HttpURLConnection.setFollowRedirects(false); HttpURLConnection con = (HttpURLConnection) new URL("http://www.google.coom").openConnection(); con.setRequestMethod("HEAD"); System.out.println(con.getResponseCode() == HttpURLConnection.HTTP_GONE); }
From source file:Main.java
public static void main(String[] argv) throws Exception { HttpURLConnection.setFollowRedirects(false); HttpURLConnection con = (HttpURLConnection) new URL("http://www.google.coom").openConnection(); con.setRequestMethod("HEAD"); System.out.println(con.getResponseCode() == HttpURLConnection.HTTP_PAYMENT_REQUIRED); }
From source file:Main.java
public static void main(String[] argv) throws Exception { HttpURLConnection.setFollowRedirects(false); HttpURLConnection con = (HttpURLConnection) new URL("http://www.google.coom").openConnection(); con.setRequestMethod("HEAD"); System.out.println(con.getResponseCode() == HttpURLConnection.HTTP_OK); }