hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <hermod.opstv...@dnbnor.no>
Subject RE: ResponseProcessCookies - CookieSpec not available in HTTPcontext
Date Wed, 24 Sep 2008 06:36:30 GMT
Hi

Sorry if I was a bit sparse here.

I writing a test client that checks the availability of page2 in a multi
sequence dialog. If you do this in a browser:

1. Enter a regular http URI for the site - You get redirected to a https
page.
2. Fill in a form field on that page and submit - The reponse is page2
(also https).


I was running a slightly modified version of the ClientExecuteProxy
sample where the I had 443 and https for the target. I then got:

ResponseProcessCookies - CookieSpec not available in HTTP context

So getting that response I assumed that I needed to set up a cookie
store - Hence my question.

I have now changed it to 80 and http, and it runs OK.

On a side note: If I run the ClientCustomContext, I get:

HTTP/1.1 200 OK
Response content length: -1
Chunked?: true

How do I get at the chuncked response? - I know that a chuncked response
comes from a persistant connection, but I have not found a sample that
shows how the API handles this type of response.


Hermod 

-----Original Message-----
From: Oleg Kalnichevski [mailto:olegk@apache.org] 
Sent: Tuesday, September 23, 2008 10:59 PM
To: HttpClient User Discussion
Subject: Re: ResponseProcessCookies - CookieSpec not available in
HTTPcontext

On Tue, 2008-09-23 at 12:10 +0200, hermod.opstvedt@dnbnor.no wrote:
> Hi
> 
> Sorry if this has been raised before, but I have searched and not 
> found an answer to this problem
> 
> I am using 4.0-beta1 client, and when I issue a request, i get the 
> following message:
> ResponseProcessCookies - CookieSpec not available in HTTP context
> 
> And in the response from the server is that request can not be 
> processed du to no support for cookies.
> 
> I have ste the following to no avail:
> 	
>
client.getParams().setParameter(ClientPNames.COOKIE_POLICY,CookiePolicy.
> BROWSER_COMPATIBILITY);
> 	

Hi Hermod

What is it exactly you are trying to do? Why are you trying to override
the default cookie policy? HttpClient 4.0 comes with a new cookie policy
that automatically picks up the best cookie spec for a particular cookie
header. If a cookie conforms to the RFC2965 HttpClient will handle it
according to that spec. If a cookie is an old fashion Netscape style
cookie, HttpClient will use the Netscape policy. If unsure, HttpClient
will use the browser compatibility spec.

There should no longer be any need to tweak the default cookie policy.

> client.getParams().setParameter(ClientContext.COOKIE_STORE, new 
> BasicCookieStore());
> 

This is wrong. If you want to provide a custom cookie store, you have to
set it in the execution context. See this example:

http://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk/module-c
lient/src/examples/org/apache/http/examples/client/ClientCustomContext.j
ava

Anyways, please post a _complete_ code sample that reproduces the
problem. I am not really that good at mind reading. Test cases / wire
logs work better for me.

Oleg 


> Hermod





> * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
> * * *
> 
> This email with attachments is solely for the use of the individual or

> entity to whom it is addressed. Please also be aware that the DnB NOR 
> Group cannot accept any payment orders or other legally binding 
> correspondence with customers as a part of an email.
> 
> This email message has been virus checked by the anti virus programs 
> used in the DnB NOR Group.
> 
> * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
> * * *
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

This email with attachments is solely for the use of the individual or
entity to whom it is addressed. Please also be aware that the DnB NOR Group
cannot accept any payment orders or other legally binding correspondence with
customers as a part of an email. 

This email message has been virus checked by the anti virus programs used
in the DnB NOR Group.

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


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