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. }