List of usage examples for java.net URL openConnection
public URLConnection openConnection() throws java.io.IOException
From source file:MainClass.java
public static void main(String[] args) throws Exception { URL u = new URL(args[0]); URLConnection uc = u.openConnection(); BufferedReader br = new BufferedReader(new InputStreamReader(uc.getInputStream())); String s = br.readLine();//from ww w . jav a2 s . c o m while (s != null) { System.out.println(s); s = br.readLine(); } }
From source file:Main.java
public static void main(String[] args) throws Exception { String s;/*from www.j ava 2s .co m*/ s = "http://www.y.com/authTest"; URL url = new URL(s); URLConnection urlc = url.openConnection(); Map<String, List<String>> hf = urlc.getHeaderFields(); for (String key : hf.keySet()) System.out.println(key + ": " + urlc.getHeaderField(key)); System.out.println(((HttpURLConnection) urlc).getResponseCode()); }
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.getRequestProperties()); }
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.getPermission()); }
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.getContentLengthLong()); }
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.getUseCaches()); }
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.getURL()); }
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.toString()); }
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.getDate()); }
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.getReadTimeout()); }