hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Arménio Pinto <armeniopi...@gmail.com>
Subject Re: HttpClient and cookies problem
Date Thu, 30 Sep 2010 08:26:39 GMT
Hi Oleg, thank you very much for your help.

I already had "org.apache.http" enabled for debug, but there isn't anything
obvious in the logs. The only cookies related-entry I can see is:

2010-09-30 09:18:23,969 DEBUG [main] RequestAddCookies
CookieSpec selected: compatibility

In attachment I send the full compressed log, in case you have some spare
time to look at it (I might be missing something relevant).

Thank you again, regards,

AP


2010/9/30 Oleg Kalnichevski <olegk@apache.org>

> On Wed, 2010-09-29 at 18:43 +0100, Arménio Pinto wrote:
> > 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
>
> Use wire / context logging to find out why cookies get rejected.
>
> http://hc.apache.org/httpcomponents-client-ga/logging.html
>
> Oleg
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org
>
>

Mime
View raw message