title: Open a connection with Jsoup, get status code and parse document
body: <p>I'm creating a class using jsoup that will do the following:</p>
  
  <ol>
  <li>The constructor opens a connection to a url.</li>
  <li>I have a method that will check the status of the page. i.e. 200, 404 etc.</li>
  <li>I have a method to parse the page and return a list of urls.#</li>
  </ol>
  
  <p>Below is a rough working of what I am trying to do, not its very rough as I've been trying a lot of different things</p>
  
  <pre><code>public class ParsePage {
  private String path;
  Connection.Response response = null;
  
  private ParsePage(String langLocale){
      try {
          response = Jsoup.connect(path)
                  .userAgent("Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.21 (KHTML, like Gecko) Chrome/19.0.1042.0 Safari/535.21")
                  .timeout(10000)
                  .execute();
      } catch (IOException e) {
          System.out.println("io - "+e);
      }
  }
  
  public int getSitemapStatus(){
      int statusCode = response.statusCode();
      return statusCode;
  }
  
  public ArrayList&lt;String&gt; getUrls(){
      ArrayList&lt;String&gt; urls = new ArrayList&lt;String&gt;();
  
   }
  }
  </code></pre>
  
  <p>As you can see I can get the page status, but using the already open connection from the constructor I don't know how to get the document to parse, I tried using:</p>
  
  <pre><code>Document doc = connection.get();
  </code></pre>
  
  <p>But that's a no go. Any suggestions? Or better ways to go about this?</p>