hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mathias Cianci <mcia...@axecibles.com>
Subject Re: change cookie value
Date Fri, 30 Jul 2004 15:00:58 GMT
Ok!

It works very fine ;-)

        Calendar cal = Calendar.getInstance(TimeZone.getDefault());
        cal.set((Calendar.YEAR),cal.get(Calendar.YEAR)+1);
        java.util.Date d = cal.getTime();       
       
        HttpClient client = new HttpClient();
        HttpState hs = client.getState();
        hs.addCookie(new Cookie("search.msn.fr", "smc_classic", 
"df=0&af=0&rc=50&nw=0&sc=&rs=1", "/", d, false));
        hs.addCookie(new Cookie("search.msn.fr", "smc_g", 
"v=1&pvs=classic&ssp=1&df=1", "/", d, false));
        client.setState(hs);
       


Mathias Cianci a écrit :

> Thank you Mike.
>
> But after a long reflexion, I've found that I've not taken the good 
> part of the problem.
>
> In fact, what I want to do is to send a Cookie in the headers of my 
> first requested page, no matter the cooklies sets by the server.
>
> How to do that ?
>
> Mathias
>
> PS: my english is not really good, don't hesitate to tell me if I'm 
> not really comprehensive.
>
> Michael Becke a écrit :
>
>> Hi Mathias,
>>
>> The best way is to just create a new instance of Cookie, copying the 
>> values you want to keep, and add it to the HttpState.
>>
>> Mike
>>
>> On Jul 30, 2004, at 3:09 AM, Mathias Cianci wrote:
>>
>>> Hello everybody,
>>>
>>> Is it possible with httpclient to change the value of a specific 
>>> variable sent in a cookie by a server.
>>>
>>> For example, when the server send the cookie var1=5&*var2=7*&var3=4,

>>> I want to save the cookie var1=5&*var2=174*&var3=4
>>>
>>> Thank you for advance,
>>>
>>> Mathias
>>> An happy httpclient-user ;-)
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: 
>> commons-httpclient-dev-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: 
>> commons-httpclient-dev-help@jakarta.apache.org
>>
>>
>>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message