Example #1
0
 static String getUrlAsString(String url) throws HTTPException {
   try (HTTPMethod m = HTTPFactory.Get(url); ) {
     int status = m.execute();
     String content = null;
     if (status == 200) {
       content = m.getResponseAsString();
     }
     return content;
   }
 }
Example #2
0
 public static String getUrlAsString(String url) throws HTTPException {
   HTTPSession session = new HTTPSession(url);
   HTTPMethod m = HTTPMethod.Get(session);
   int status = m.execute();
   String content = null;
   if (status == 200) {
     content = m.getResponseAsString();
   }
   m.close();
   return content;
 }