Pastebin launched a little side project called HostCabi.net, check it out ;-)Don't like ads? PRO users don't see any ads ;-)
Guest

Request

By: a guest on Oct 7th, 2012  |  syntax: None  |  size: 0.89 KB  |  hits: 60  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. /*
  2.  * To change this template, choose Tools | Templates
  3.  * and open the template in the editor.
  4.  */
  5. package com.infobip.jsouptest;
  6.  
  7. import java.io.IOException;
  8. import java.util.concurrent.Callable;
  9. import org.jsoup.Jsoup;
  10. import org.jsoup.nodes.Document;
  11.  
  12. /**
  13.  *
  14.  * @author linski
  15.  */
  16. public class Request implements  Callable<Document> {
  17.    
  18.     public final String url;
  19.  
  20.     public Request(String url) {
  21.         this.url = url;
  22.     }    
  23.    
  24.  
  25.     public Document call() throws Exception {
  26.          Document doc = null;
  27.         try {
  28.             doc = Jsoup.connect(url).timeout(0).get();
  29.         } catch (IOException ex) {
  30.             ex.printStackTrace();
  31.             System.out.println("\n\n\t\t"+url+"\n\n");
  32.         }
  33.         return doc;
  34.     }
  35.  
  36.     @Override
  37.     public String toString() {
  38.         return "Request{" + "url=" + url + '}';
  39.     }
  40.    
  41.    
  42.    
  43. }