title: Enable cookies with HTTPClient
body: <p>I am trying to implement a Java Code that fetch urls like this one:
  <a href="http://trendistic.indextank.com/_trending-topics-archive/2011-12-25" rel="nofollow">http://trendistic.indextank.com/_trending-topics-archive/2011-12-25</a></p>
  
  <p>The code I wrote is based in HTTPClient as follow:</p>
  
  <pre><code>    HttpClient httpclient = new DefaultHttpClient();
      // Create a local instance of cookie store
      CookieStore cookieStore = new BasicCookieStore();
      // Create local HTTP context
      HttpContext localContext = new BasicHttpContext();
      // Bind custom cookie store to the local context
      localContext.setAttribute(ClientContext.COOKIE_STORE, cookieStore);
  
      HttpGet httpget = new HttpGet(urls);
  
      try {
          System.out.println("executing request " + httpget.getURI());
          HttpResponse response = httpclient.execute(httpget, localContext);
          String line = "";
          StringBuilder total = new StringBuilder();
          BufferedReader rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
          while ((line = rd.readLine()) != null) {
              total.append(line+"\n");
          }
          System.out.println(total);
  
          return (total.toString());
  
      } catch (Exception e) {
          e.printStackTrace();
          return(e.getMessage());
      }
  }
  </code></pre>
  
  <p>Nevertheless, the response I got is: </p>
  
  <pre><code>if (tz != tzless.readCookie('local_tz')) {
      // no cookies!
      document.write("&lt;h1&gt;Cookies are not enabled for this site&lt;/h1&gt;");
      document.write("&lt;p&gt;In order for Trendistic to work in Internet Explorer you need to enable cookies.&lt;/p&gt;");
      document.write("&lt;ul&gt;&lt;li&gt;Please enable cookies for this site and refresh this page&lt;/li&gt;&lt;li&gt;Or try Trendistic in a different browser such as Safari, Firefox or Chrome.&lt;/li&gt;&lt;/ul&gt;");
  } else {
      self.location.reload();
  }
  </code></pre>
  
  <p>How can I enable cookies for fetching the HTML with the dynamical results.</p>