Hi there,

I'm trying to use HttpClient on http://www.flybe.com with the objective of
downloading the main page HTML content and the site cookies. The code is as
follows:

final DefaultHttpClient client=new DefaultHttpClient();

final HttpParams params=client.getParams();
params.setParameter("http.protocol.version", HttpVersion.HTTP_1_1);
params.setParameter("http.useragent", "Mozilla/5.0 (Windows; U; Windows NT
6.1; he; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3");
params.setParameter(ClientPNames.COOKIE_POLICY,
CookiePolicy.BROWSER_COMPATIBILITY);

final BasicCookieStore cookies=new BasicCookieStore();
final HttpContext context=new BasicHttpContext();
context.setAttribute(ClientContext.COOKIE_STORE, cookies);

final HttpGet request=new HttpGet("http://www.flybe.com/";);
final HttpResponse response=client.execute(request, context);
for (final Cookie cookie: cookies.getCookies()) {
LOGGER.debug(cookie.getName()+" = "+cookie.getValue());
}

This code doesn't return any cookie for the site above, but works fine with
other sites, like www.google.com, for example.

Am I missing some specific configuration? Can any of you please help? Thank
you very much for your time and attention, regards,

AP

Reply via email to