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 args[]) throws Exception { URL u = new URL("http://www.java2s.com"); URLConnection uc = u.openConnection(); System.out.println(uc.getAllowUserInteraction()); }
From source file:Main.java
public static void main(String args[]) throws Exception { URL u = new URL("http://www.java2s.com"); URLConnection uc = u.openConnection(); System.out.println(uc.getConnectTimeout()); }
From source file:Main.java
public static void main(String[] argv) throws Exception { URL relativeURL, baseURL;//from w w w .j a v a 2 s. c o m baseURL = new URL("http://www.yourserver.com/"); relativeURL = new URL(baseURL, "./a.htm"); System.out.println(relativeURL.toExternalForm()); }
From source file:Main.java
public static void main(String[] argv) throws Exception { URL relativeURL, baseURL;/*from w ww . j a v a 2 s . co m*/ baseURL = new URL("http://www.java2s.com/abc/d.htm"); relativeURL = new URL(baseURL, "../a.htm"); System.out.println(relativeURL.toExternalForm()); }
From source file:Main.java
public static void main(String[] argv) throws Exception { URL url = new URL("jar:file:/c://my.jar!/"); JarURLConnection conn = (JarURLConnection) url.openConnection(); String entryName = conn.getEntryName(); // null }
From source file:Main.java
public static void main(String[] args) { try {//from w w w .j a va 2s .c om URL url = new URL("http://www.java2s.com"); System.out.println("URL is " + url.hashCode()); } catch (IOException e) { e.printStackTrace(); } }
From source file:Main.java
public static void main(String[] argv) throws Exception { URL url = new URL("jar:file:/c://my.jar!/"); JarURLConnection conn = (JarURLConnection) url.openConnection(); url = conn.getJarFileURL();/* w w w .j av a 2 s . c om*/ System.out.println(url); }
From source file:Main.java
public static void main(String args[]) throws Exception { URL u = new URL("http://www.java2s.com"); URLConnection uc = u.openConnection(); uc.setDefaultUseCaches(true);/* w ww .jav a2 s . c o m*/ System.out.println(uc.getDefaultUseCaches()); }
From source file:Main.java
public static void main(String args[]) throws Exception { URL u = new URL("http://www.java2s.com"); URLConnection uc = u.openConnection(); uc.setReadTimeout(1000);/*from w w w .j a v a 2 s .c om*/ System.out.println(uc.getReadTimeout()); }
From source file:Main.java
public static void main(String args[]) throws Exception { URL u = new URL("http://www.java2s.com"); URLConnection uc = u.openConnection(); uc.setAllowUserInteraction(true);// w w w .j ava2 s . c o m System.out.println(uc.getAllowUserInteraction()); }