1 23 24 package org.infoglue.cms.plugins.codeeditor; 25 26 import java.io.BufferedReader ; 27 import java.io.InputStream ; 28 import java.io.InputStreamReader ; 29 import java.net.URL ; 30 import java.net.URLConnection ; 31 32 40 41 42 public class HttpUtilities 43 { 44 45 47 private HttpUtilities() 48 {} 49 50 51 public static String getUrlContent(String urlAddress) throws Exception 52 { 53 URL url = new URL (urlAddress); 54 URLConnection connection = url.openConnection(); 55 connection.setUseCaches(false); 56 InputStream inStream = null; 57 inStream = connection.getInputStream(); 58 InputStreamReader inStreamReader = new InputStreamReader (inStream); 59 BufferedReader buffer = new BufferedReader (inStreamReader); 60 StringBuffer strbuf = new StringBuffer (); 61 String line; 62 while((line = buffer.readLine()) != null) 63 { 64 strbuf.append(line); 65 } 66 String readData = strbuf.toString(); 67 buffer.close(); 68 return readData; 69 } 70 71 } 72 | Popular Tags |