You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Sushil Vegad <vs...@serebrum.com> on 2008/02/11 17:10:45 UTC

Incorrect cookie value in tomcat5.5.26

Hello,

We upgraded to tomcat 5.5.26 from 5.0.28 and now its returning incorrect
cookie value.

 

We are setting user email/id in a cookie to remember the user, as follows

Cookie cookie = new Cookie(Constants.COOKIE_NAME, "vsushil@serebrum.com");

 

On doing cookie.getValue(), tomcat 5.5.26 just returns vsushil instead of
the whole string. Since some of our code was written on JDK 1.4, we
installed the JDK 4 compatibility package for tomcat5.5.26 

 

Please let me know the possible options to fix this.

 

Thanks,

Sushil Vegad

Technical Lead, Scheduling Project

Serebrum Corporation - translating strategy into results

Work: 609.777.3563

Cell: 732.216.4908      

Email: vsushil@serebrum.com

Conference Dial-in: 1-218-486-1300, Bridge: 427526

 


RE: Incorrect cookie value in tomcat5.5.26

Posted by Sushil Vegad <vs...@serebrum.com>.
Thanks a lot, that fixed it

Thanks,
Sushil Vegad
Technical Lead, Scheduling Project
Serebrum Corporation - translating strategy into results
Work: 609.777.3563
Cell: 732.216.4908      
Email: vsushil@serebrum.com
Conference Dial-in: 1-218-486-1300, Bridge: 427526
 
-----Original Message-----
From: Filip Hanik - Dev Lists [mailto:devlists@hanik.com] 
Sent: Monday, February 11, 2008 11:54 AM
To: Tomcat Users List
Subject: Re: Incorrect cookie value in tomcat5.5.26

not broken, corrected. the java doc says


      setValue

public void *setValue*(String
<http://java.sun.com/j2se/1.5/docs/api/java/lang/String.html> newValue)

    Assigns a new value to a cookie after the cookie is created. If you
    use a binary value, you may want to use BASE64 encoding.

    With Version 0 cookies, values should not contain white space,
    brackets, parentheses, equals signs, commas, double quotes, slashes,
    question marks, at signs, colons, and semicolons. Empty values may
    not behave the same way on all browsers.

    *Parameters:*
        |newValue| - a |String| specifying the new value


to fix this, all you need to do is

cookie.setVersion(1);

Filip

Konstantin Kolinko wrote:
> I guess the cause is the same as for tomcat 6.0.16.
> See messages entitles "Cookies are broken in 6.0.16?".
>
> http://www.nabble.com/Cookies-are-broken-in-6.0.16--to15369118.html
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
>
>   


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org





---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Incorrect cookie value in tomcat5.5.26

Posted by Sushil Vegad <vs...@serebrum.com>.
Our code is the same as yours. Our scenario is we set the username in the
cookie when the user logs in

 

Cookie cookie = new Cookie(Constants.REMEMBERME, username);

cookie.setVersion(1);

cookie.setMaxAge(Integer.MAX_VALUE);

response.addCookie(cookie);

 

When the user opens a new browser instance to log-in, we check for the
cookie to populate the username on the login page

 

Cookie cookies[] = request.getCookies();

String username = "";

for (int i = 0; i < cookies.length; i++) {

Cookie c = cookies[i];

      if (c.getName().equals(Constants.REMEMBERME)) {

            username = c.getValue();

            break;

      }

}

 

I open a new browser instance, log-in and the cookie is set. If I logout and
return to login screen (on the same browser instance) the cookie is found.

If I use a NEW browser instance to go to the login page, the REMEMBERME
cookie is NOT found. With the same code, we did not have this issue with
tomcat 5.0

 

Thanks,

Sushil

 

-----Original Message-----
From: Filip Hanik - Dev Lists [mailto:devlists@hanik.com] 
Sent: Monday, February 25, 2008 6:54 PM
To: Tomcat Users List
Subject: Re: Incorrect cookie value in tomcat5.5.26

 

what is your scenario,

 

the following code worked for me, even though the browser doesn't send 

up cookie version

 

<%

  javax.servlet.http.Cookie[] cs = request.getCookies();

  String value = null;

  for (Cookie co : cs) {

    if ("test".equals(co.getName())) value = co.getValue();

 

  }

 

  javax.servlet.http.Cookie c = new 

javax.servlet.http.Cookie("test","someemail=somedomain.com");

  c.setVersion(1);

  c.setMaxAge(1000000);

  response.addCookie(c);

 

%>

done!<br/>

<%=value%>

 

 

 

Sushil Vegad wrote:

> Hello,

> 

> cookie.setVersion(1) remembers the cookie only for the browser session. A

> new browser does not have access to the cookie

> 

> We did cookie.setMaxAge(Integer.MAX_VALUE) but that doesn't help.

> 

> Any thoughts please?

> 

> Thanks,

> Sushil Vegad

> Technical Lead, Scheduling Project

> Serebrum Corporation - translating strategy into results

> Work: 609.777.3563

> Cell: 732.216.4908      

> Email: vsushil@serebrum.com

> Conference Dial-in: 1-218-486-1300, Bridge: 427526

>  

> 

> -----Original Message-----

> From: Filip Hanik - Dev Lists [mailto:devlists@hanik.com] 

> Sent: Monday, February 11, 2008 11:54 AM

> To: Tomcat Users List

> Subject: Re: Incorrect cookie value in tomcat5.5.26

> 

> not broken, corrected. the java doc says

> 

> 

>       setValue

> 

> public void *setValue*(String

> <http://java.sun.com/j2se/1.5/docs/api/java/lang/String.html> newValue)

> 

>     Assigns a new value to a cookie after the cookie is created. If you

>     use a binary value, you may want to use BASE64 encoding.

> 

>     With Version 0 cookies, values should not contain white space,

>     brackets, parentheses, equals signs, commas, double quotes, slashes,

>     question marks, at signs, colons, and semicolons. Empty values may

>     not behave the same way on all browsers.

> 

>     *Parameters:*

>         |newValue| - a |String| specifying the new value

> 

> 

> to fix this, all you need to do is

> 

> cookie.setVersion(1);

> 

> Filip

> 

> Konstantin Kolinko wrote:

>   

>> I guess the cause is the same as for tomcat 6.0.16.

>> See messages entitles "Cookies are broken in 6.0.16?".

>> 

>> http://www.nabble.com/Cookies-are-broken-in-6.0.16--to15369118.html

>> 

>> ---------------------------------------------------------------------

>> To start a new topic, e-mail: users@tomcat.apache.org

>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org

>> For additional commands, e-mail: users-help@tomcat.apache.org

>> 

>> 

>> 

>>   

>>     

> 

> 

> ---------------------------------------------------------------------

> To start a new topic, e-mail: users@tomcat.apache.org

> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org

> For additional commands, e-mail: users-help@tomcat.apache.org

> 

> 

> 

> 

> 

> ---------------------------------------------------------------------

> To start a new topic, e-mail: users@tomcat.apache.org

> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org

> For additional commands, e-mail: users-help@tomcat.apache.org

> 

> 

> 

>   

 

 

---------------------------------------------------------------------

To start a new topic, e-mail: users@tomcat.apache.org

To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org

For additional commands, e-mail: users-help@tomcat.apache.org

 

 


RE: Incorrect cookie value in tomcat5.5.26

Posted by Sushil Vegad <vs...@serebrum.com>.
Filip,
That does it - set the cookie value in quotes and remove the
cookie.setVersion(1) on tomcat 5.5.26. I can now see the cookie file being
written under C:\Documents and Settings\Sushil\Cookies. A new browser
instance is also picking up the cookie.

Looks like the setVersion(1) sets the cookie only for the browser session

Thanks again for you help.
Sushil 

-----Original Message-----
From: Filip Hanik - Dev Lists [mailto:devlists@hanik.com] 
Sent: Thursday, February 28, 2008 10:43 AM
To: Tomcat Users List
Subject: Re: Incorrect cookie value in tomcat5.5.26

I haven't looked at the code, but give this is a shot

Cookie cookie = new Cookie(Constants.REMEMBERME, "\""+username+"\"");
cookie.setMaxAge(Integer.MAX_VALUE);
response.addCookie(cookie);

Filip

Sushil Vegad wrote:
> Filip,
> As for the actual code, what I gave below is all there is to the cookie
> code. The test case too would be what I described below.
>
> I hadn't checked before, but we are facing this issue even with tomcat 5.0
> when I do cookie.setVersion(1). 
>
> The other thing I noticed with cookie.setVersion(1) on tomcat5.5.26 and
> tomcat5.0 is the cookie file is not being written under - C:\Documents and
> Settings\Sushil\Cookies.
>
> If you are looking for some specific code or need me to describe further,
> please let me know
>
> Thanks,
> Sushil 
>  
> -----Original Message-----
> From: Filip Hanik - Dev Lists [mailto:devlists@hanik.com] 
> Sent: Wednesday, February 27, 2008 1:49 PM
> To: Tomcat Users List
> Subject: Re: Incorrect cookie value in tomcat5.5.26
>
> hi Sushil
> that scenario works just fine for me. you would have to show your actual 
> code (and a test case) for me to analyze your actual problem
>
> Filip
>
> Sushil Vegad wrote:
>   
>> Hello Filip,
>>
>> Please let me know your thoughts on this.
>>
>> Our scenario is:
>> We set the username in the cookie when the user logs in. I open a new
>> browser instance, log-in and the cookie is set. If I logout of the
>> application and return to login screen (on the same browser instance) the
>> cookie is found.
>>
>> PROBLEM:
>> If I use a NEW browser instance to go to the login page, the cookie is
NOT
>> found. 
>>
>> On login submit, we set the cookie - 
>> Cookie cookie = new Cookie(Constants.REMEMBERME, username);
>> cookie.setVersion(1);
>> cookie.setMaxAge(Integer.MAX_VALUE);
>> response.addCookie(cookie);
>>
>>
>> On requesting the login page, we check if the cookie was set - 
>>
>> Cookie cookies[] = request.getCookies();
>> String username = "";
>> for (int i = 0; i < cookies.length; i++) {
>> Cookie c = cookies[i];
>>       if (c.getName().equals(Constants.REMEMBERME)) {
>>             username = c.getValue();//Set username in the login field
>>             break;
>>       }
>> }
>>
>> This code did not have an issue with tomcat 5.0
>> Thanks,
>> Sushil
>>  
>>
>> -----Original Message-----
>> From: Filip Hanik - Dev Lists [mailto:devlists@hanik.com] 
>> Sent: Monday, February 25, 2008 6:54 PM
>> To: Tomcat Users List
>> Subject: Re: Incorrect cookie value in tomcat5.5.26
>>
>> what is your scenario,
>>
>> the following code worked for me, even though the browser doesn't send 
>> up cookie version
>>
>> <%
>>   javax.servlet.http.Cookie[] cs = request.getCookies();
>>   String value = null;
>>   for (Cookie co : cs) {
>>     if ("test".equals(co.getName())) value = co.getValue();
>>  
>>   }
>>
>>   javax.servlet.http.Cookie c = new 
>> javax.servlet.http.Cookie("test","someemail=somedomain.com");
>>   c.setVersion(1);
>>   c.setMaxAge(1000000);
>>   response.addCookie(c);
>>
>> %>
>> done!<br/>
>> <%=value%>
>>
>>
>>
>> Sushil Vegad wrote:
>>   
>>     
>>> Hello,
>>>
>>> cookie.setVersion(1) remembers the cookie only for the browser session.
A
>>> new browser does not have access to the cookie
>>>
>>> We did cookie.setMaxAge(Integer.MAX_VALUE) but that doesn't help.
>>>
>>> Any thoughts please?
>>>
>>> Thanks,
>>> Sushil Vegad
>>> Technical Lead, Scheduling Project
>>> Serebrum Corporation - translating strategy into results
>>> Work: 609.777.3563
>>> Cell: 732.216.4908      
>>> Email: vsushil@serebrum.com
>>> Conference Dial-in: 1-218-486-1300, Bridge: 427526
>>>  
>>>
>>> -----Original Message-----
>>> From: Filip Hanik - Dev Lists [mailto:devlists@hanik.com] 
>>> Sent: Monday, February 11, 2008 11:54 AM
>>> To: Tomcat Users List
>>> Subject: Re: Incorrect cookie value in tomcat5.5.26
>>>
>>> not broken, corrected. the java doc says
>>>
>>>
>>>       setValue
>>>
>>> public void *setValue*(String
>>> <http://java.sun.com/j2se/1.5/docs/api/java/lang/String.html> newValue)
>>>
>>>     Assigns a new value to a cookie after the cookie is created. If you
>>>     use a binary value, you may want to use BASE64 encoding.
>>>
>>>     With Version 0 cookies, values should not contain white space,
>>>     brackets, parentheses, equals signs, commas, double quotes, slashes,
>>>     question marks, at signs, colons, and semicolons. Empty values may
>>>     not behave the same way on all browsers.
>>>
>>>     *Parameters:*
>>>         |newValue| - a |String| specifying the new value
>>>
>>>
>>> to fix this, all you need to do is
>>>
>>> cookie.setVersion(1);
>>>
>>> Filip
>>>
>>> Konstantin Kolinko wrote:
>>>   
>>>     
>>>       
>>>> I guess the cause is the same as for tomcat 6.0.16.
>>>> See messages entitles "Cookies are broken in 6.0.16?".
>>>>
>>>> http://www.nabble.com/Cookies-are-broken-in-6.0.16--to15369118.html
>>>>
>>>> ---------------------------------------------------------------------
>>>> To start a new topic, e-mail: users@tomcat.apache.org
>>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>>
>>>>
>>>>
>>>>   
>>>>     
>>>>       
>>>>         
>>> ---------------------------------------------------------------------
>>> To start a new topic, e-mail: users@tomcat.apache.org
>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>
>>>
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To start a new topic, e-mail: users@tomcat.apache.org
>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>
>>>
>>>
>>>   
>>>     
>>>       
>> ---------------------------------------------------------------------
>> To start a new topic, e-mail: users@tomcat.apache.org
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To start a new topic, e-mail: users@tomcat.apache.org
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
>>
>>   
>>     
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
>
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
>
>   


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org





---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Incorrect cookie value in tomcat5.5.26

Posted by Filip Hanik - Dev Lists <de...@hanik.com>.
I haven't looked at the code, but give this is a shot

Cookie cookie = new Cookie(Constants.REMEMBERME, "\""+username+"\"");
cookie.setMaxAge(Integer.MAX_VALUE);
response.addCookie(cookie);

Filip

Sushil Vegad wrote:
> Filip,
> As for the actual code, what I gave below is all there is to the cookie
> code. The test case too would be what I described below.
>
> I hadn't checked before, but we are facing this issue even with tomcat 5.0
> when I do cookie.setVersion(1). 
>
> The other thing I noticed with cookie.setVersion(1) on tomcat5.5.26 and
> tomcat5.0 is the cookie file is not being written under - C:\Documents and
> Settings\Sushil\Cookies.
>
> If you are looking for some specific code or need me to describe further,
> please let me know
>
> Thanks,
> Sushil 
>  
> -----Original Message-----
> From: Filip Hanik - Dev Lists [mailto:devlists@hanik.com] 
> Sent: Wednesday, February 27, 2008 1:49 PM
> To: Tomcat Users List
> Subject: Re: Incorrect cookie value in tomcat5.5.26
>
> hi Sushil
> that scenario works just fine for me. you would have to show your actual 
> code (and a test case) for me to analyze your actual problem
>
> Filip
>
> Sushil Vegad wrote:
>   
>> Hello Filip,
>>
>> Please let me know your thoughts on this.
>>
>> Our scenario is:
>> We set the username in the cookie when the user logs in. I open a new
>> browser instance, log-in and the cookie is set. If I logout of the
>> application and return to login screen (on the same browser instance) the
>> cookie is found.
>>
>> PROBLEM:
>> If I use a NEW browser instance to go to the login page, the cookie is NOT
>> found. 
>>
>> On login submit, we set the cookie - 
>> Cookie cookie = new Cookie(Constants.REMEMBERME, username);
>> cookie.setVersion(1);
>> cookie.setMaxAge(Integer.MAX_VALUE);
>> response.addCookie(cookie);
>>
>>
>> On requesting the login page, we check if the cookie was set - 
>>
>> Cookie cookies[] = request.getCookies();
>> String username = "";
>> for (int i = 0; i < cookies.length; i++) {
>> Cookie c = cookies[i];
>>       if (c.getName().equals(Constants.REMEMBERME)) {
>>             username = c.getValue();//Set username in the login field
>>             break;
>>       }
>> }
>>
>> This code did not have an issue with tomcat 5.0
>> Thanks,
>> Sushil
>>  
>>
>> -----Original Message-----
>> From: Filip Hanik - Dev Lists [mailto:devlists@hanik.com] 
>> Sent: Monday, February 25, 2008 6:54 PM
>> To: Tomcat Users List
>> Subject: Re: Incorrect cookie value in tomcat5.5.26
>>
>> what is your scenario,
>>
>> the following code worked for me, even though the browser doesn't send 
>> up cookie version
>>
>> <%
>>   javax.servlet.http.Cookie[] cs = request.getCookies();
>>   String value = null;
>>   for (Cookie co : cs) {
>>     if ("test".equals(co.getName())) value = co.getValue();
>>  
>>   }
>>
>>   javax.servlet.http.Cookie c = new 
>> javax.servlet.http.Cookie("test","someemail=somedomain.com");
>>   c.setVersion(1);
>>   c.setMaxAge(1000000);
>>   response.addCookie(c);
>>
>> %>
>> done!<br/>
>> <%=value%>
>>
>>
>>
>> Sushil Vegad wrote:
>>   
>>     
>>> Hello,
>>>
>>> cookie.setVersion(1) remembers the cookie only for the browser session. A
>>> new browser does not have access to the cookie
>>>
>>> We did cookie.setMaxAge(Integer.MAX_VALUE) but that doesn't help.
>>>
>>> Any thoughts please?
>>>
>>> Thanks,
>>> Sushil Vegad
>>> Technical Lead, Scheduling Project
>>> Serebrum Corporation - translating strategy into results
>>> Work: 609.777.3563
>>> Cell: 732.216.4908      
>>> Email: vsushil@serebrum.com
>>> Conference Dial-in: 1-218-486-1300, Bridge: 427526
>>>  
>>>
>>> -----Original Message-----
>>> From: Filip Hanik - Dev Lists [mailto:devlists@hanik.com] 
>>> Sent: Monday, February 11, 2008 11:54 AM
>>> To: Tomcat Users List
>>> Subject: Re: Incorrect cookie value in tomcat5.5.26
>>>
>>> not broken, corrected. the java doc says
>>>
>>>
>>>       setValue
>>>
>>> public void *setValue*(String
>>> <http://java.sun.com/j2se/1.5/docs/api/java/lang/String.html> newValue)
>>>
>>>     Assigns a new value to a cookie after the cookie is created. If you
>>>     use a binary value, you may want to use BASE64 encoding.
>>>
>>>     With Version 0 cookies, values should not contain white space,
>>>     brackets, parentheses, equals signs, commas, double quotes, slashes,
>>>     question marks, at signs, colons, and semicolons. Empty values may
>>>     not behave the same way on all browsers.
>>>
>>>     *Parameters:*
>>>         |newValue| - a |String| specifying the new value
>>>
>>>
>>> to fix this, all you need to do is
>>>
>>> cookie.setVersion(1);
>>>
>>> Filip
>>>
>>> Konstantin Kolinko wrote:
>>>   
>>>     
>>>       
>>>> I guess the cause is the same as for tomcat 6.0.16.
>>>> See messages entitles "Cookies are broken in 6.0.16?".
>>>>
>>>> http://www.nabble.com/Cookies-are-broken-in-6.0.16--to15369118.html
>>>>
>>>> ---------------------------------------------------------------------
>>>> To start a new topic, e-mail: users@tomcat.apache.org
>>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>>
>>>>
>>>>
>>>>   
>>>>     
>>>>       
>>>>         
>>> ---------------------------------------------------------------------
>>> To start a new topic, e-mail: users@tomcat.apache.org
>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>
>>>
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To start a new topic, e-mail: users@tomcat.apache.org
>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>
>>>
>>>
>>>   
>>>     
>>>       
>> ---------------------------------------------------------------------
>> To start a new topic, e-mail: users@tomcat.apache.org
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To start a new topic, e-mail: users@tomcat.apache.org
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
>>
>>   
>>     
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
>
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
>
>   


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Incorrect cookie value in tomcat5.5.26

Posted by Sushil Vegad <vs...@serebrum.com>.
Filip,
As for the actual code, what I gave below is all there is to the cookie
code. The test case too would be what I described below.

I hadn't checked before, but we are facing this issue even with tomcat 5.0
when I do cookie.setVersion(1). 

The other thing I noticed with cookie.setVersion(1) on tomcat5.5.26 and
tomcat5.0 is the cookie file is not being written under - C:\Documents and
Settings\Sushil\Cookies.

If you are looking for some specific code or need me to describe further,
please let me know

Thanks,
Sushil 
 
-----Original Message-----
From: Filip Hanik - Dev Lists [mailto:devlists@hanik.com] 
Sent: Wednesday, February 27, 2008 1:49 PM
To: Tomcat Users List
Subject: Re: Incorrect cookie value in tomcat5.5.26

hi Sushil
that scenario works just fine for me. you would have to show your actual 
code (and a test case) for me to analyze your actual problem

Filip

Sushil Vegad wrote:
> Hello Filip,
>
> Please let me know your thoughts on this.
>
> Our scenario is:
> We set the username in the cookie when the user logs in. I open a new
> browser instance, log-in and the cookie is set. If I logout of the
> application and return to login screen (on the same browser instance) the
> cookie is found.
>
> PROBLEM:
> If I use a NEW browser instance to go to the login page, the cookie is NOT
> found. 
>
> On login submit, we set the cookie - 
> Cookie cookie = new Cookie(Constants.REMEMBERME, username);
> cookie.setVersion(1);
> cookie.setMaxAge(Integer.MAX_VALUE);
> response.addCookie(cookie);
>
>
> On requesting the login page, we check if the cookie was set - 
>
> Cookie cookies[] = request.getCookies();
> String username = "";
> for (int i = 0; i < cookies.length; i++) {
> Cookie c = cookies[i];
>       if (c.getName().equals(Constants.REMEMBERME)) {
>             username = c.getValue();//Set username in the login field
>             break;
>       }
> }
>
> This code did not have an issue with tomcat 5.0
> Thanks,
> Sushil
>  
>
> -----Original Message-----
> From: Filip Hanik - Dev Lists [mailto:devlists@hanik.com] 
> Sent: Monday, February 25, 2008 6:54 PM
> To: Tomcat Users List
> Subject: Re: Incorrect cookie value in tomcat5.5.26
>
> what is your scenario,
>
> the following code worked for me, even though the browser doesn't send 
> up cookie version
>
> <%
>   javax.servlet.http.Cookie[] cs = request.getCookies();
>   String value = null;
>   for (Cookie co : cs) {
>     if ("test".equals(co.getName())) value = co.getValue();
>  
>   }
>
>   javax.servlet.http.Cookie c = new 
> javax.servlet.http.Cookie("test","someemail=somedomain.com");
>   c.setVersion(1);
>   c.setMaxAge(1000000);
>   response.addCookie(c);
>
> %>
> done!<br/>
> <%=value%>
>
>
>
> Sushil Vegad wrote:
>   
>> Hello,
>>
>> cookie.setVersion(1) remembers the cookie only for the browser session. A
>> new browser does not have access to the cookie
>>
>> We did cookie.setMaxAge(Integer.MAX_VALUE) but that doesn't help.
>>
>> Any thoughts please?
>>
>> Thanks,
>> Sushil Vegad
>> Technical Lead, Scheduling Project
>> Serebrum Corporation - translating strategy into results
>> Work: 609.777.3563
>> Cell: 732.216.4908      
>> Email: vsushil@serebrum.com
>> Conference Dial-in: 1-218-486-1300, Bridge: 427526
>>  
>>
>> -----Original Message-----
>> From: Filip Hanik - Dev Lists [mailto:devlists@hanik.com] 
>> Sent: Monday, February 11, 2008 11:54 AM
>> To: Tomcat Users List
>> Subject: Re: Incorrect cookie value in tomcat5.5.26
>>
>> not broken, corrected. the java doc says
>>
>>
>>       setValue
>>
>> public void *setValue*(String
>> <http://java.sun.com/j2se/1.5/docs/api/java/lang/String.html> newValue)
>>
>>     Assigns a new value to a cookie after the cookie is created. If you
>>     use a binary value, you may want to use BASE64 encoding.
>>
>>     With Version 0 cookies, values should not contain white space,
>>     brackets, parentheses, equals signs, commas, double quotes, slashes,
>>     question marks, at signs, colons, and semicolons. Empty values may
>>     not behave the same way on all browsers.
>>
>>     *Parameters:*
>>         |newValue| - a |String| specifying the new value
>>
>>
>> to fix this, all you need to do is
>>
>> cookie.setVersion(1);
>>
>> Filip
>>
>> Konstantin Kolinko wrote:
>>   
>>     
>>> I guess the cause is the same as for tomcat 6.0.16.
>>> See messages entitles "Cookies are broken in 6.0.16?".
>>>
>>> http://www.nabble.com/Cookies-are-broken-in-6.0.16--to15369118.html
>>>
>>> ---------------------------------------------------------------------
>>> To start a new topic, e-mail: users@tomcat.apache.org
>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>
>>>
>>>
>>>   
>>>     
>>>       
>> ---------------------------------------------------------------------
>> To start a new topic, e-mail: users@tomcat.apache.org
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To start a new topic, e-mail: users@tomcat.apache.org
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
>>
>>   
>>     
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
>
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
>
>   


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org





---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Incorrect cookie value in tomcat5.5.26

Posted by Filip Hanik - Dev Lists <de...@hanik.com>.
hi Sushil
that scenario works just fine for me. you would have to show your actual 
code (and a test case) for me to analyze your actual problem

Filip

Sushil Vegad wrote:
> Hello Filip,
>
> Please let me know your thoughts on this.
>
> Our scenario is:
> We set the username in the cookie when the user logs in. I open a new
> browser instance, log-in and the cookie is set. If I logout of the
> application and return to login screen (on the same browser instance) the
> cookie is found.
>
> PROBLEM:
> If I use a NEW browser instance to go to the login page, the cookie is NOT
> found. 
>
> On login submit, we set the cookie - 
> Cookie cookie = new Cookie(Constants.REMEMBERME, username);
> cookie.setVersion(1);
> cookie.setMaxAge(Integer.MAX_VALUE);
> response.addCookie(cookie);
>
>
> On requesting the login page, we check if the cookie was set - 
>
> Cookie cookies[] = request.getCookies();
> String username = "";
> for (int i = 0; i < cookies.length; i++) {
> Cookie c = cookies[i];
>       if (c.getName().equals(Constants.REMEMBERME)) {
>             username = c.getValue();//Set username in the login field
>             break;
>       }
> }
>
> This code did not have an issue with tomcat 5.0
> Thanks,
> Sushil
>  
>
> -----Original Message-----
> From: Filip Hanik - Dev Lists [mailto:devlists@hanik.com] 
> Sent: Monday, February 25, 2008 6:54 PM
> To: Tomcat Users List
> Subject: Re: Incorrect cookie value in tomcat5.5.26
>
> what is your scenario,
>
> the following code worked for me, even though the browser doesn't send 
> up cookie version
>
> <%
>   javax.servlet.http.Cookie[] cs = request.getCookies();
>   String value = null;
>   for (Cookie co : cs) {
>     if ("test".equals(co.getName())) value = co.getValue();
>  
>   }
>
>   javax.servlet.http.Cookie c = new 
> javax.servlet.http.Cookie("test","someemail=somedomain.com");
>   c.setVersion(1);
>   c.setMaxAge(1000000);
>   response.addCookie(c);
>
> %>
> done!<br/>
> <%=value%>
>
>
>
> Sushil Vegad wrote:
>   
>> Hello,
>>
>> cookie.setVersion(1) remembers the cookie only for the browser session. A
>> new browser does not have access to the cookie
>>
>> We did cookie.setMaxAge(Integer.MAX_VALUE) but that doesn't help.
>>
>> Any thoughts please?
>>
>> Thanks,
>> Sushil Vegad
>> Technical Lead, Scheduling Project
>> Serebrum Corporation - translating strategy into results
>> Work: 609.777.3563
>> Cell: 732.216.4908      
>> Email: vsushil@serebrum.com
>> Conference Dial-in: 1-218-486-1300, Bridge: 427526
>>  
>>
>> -----Original Message-----
>> From: Filip Hanik - Dev Lists [mailto:devlists@hanik.com] 
>> Sent: Monday, February 11, 2008 11:54 AM
>> To: Tomcat Users List
>> Subject: Re: Incorrect cookie value in tomcat5.5.26
>>
>> not broken, corrected. the java doc says
>>
>>
>>       setValue
>>
>> public void *setValue*(String
>> <http://java.sun.com/j2se/1.5/docs/api/java/lang/String.html> newValue)
>>
>>     Assigns a new value to a cookie after the cookie is created. If you
>>     use a binary value, you may want to use BASE64 encoding.
>>
>>     With Version 0 cookies, values should not contain white space,
>>     brackets, parentheses, equals signs, commas, double quotes, slashes,
>>     question marks, at signs, colons, and semicolons. Empty values may
>>     not behave the same way on all browsers.
>>
>>     *Parameters:*
>>         |newValue| - a |String| specifying the new value
>>
>>
>> to fix this, all you need to do is
>>
>> cookie.setVersion(1);
>>
>> Filip
>>
>> Konstantin Kolinko wrote:
>>   
>>     
>>> I guess the cause is the same as for tomcat 6.0.16.
>>> See messages entitles "Cookies are broken in 6.0.16?".
>>>
>>> http://www.nabble.com/Cookies-are-broken-in-6.0.16--to15369118.html
>>>
>>> ---------------------------------------------------------------------
>>> To start a new topic, e-mail: users@tomcat.apache.org
>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>
>>>
>>>
>>>   
>>>     
>>>       
>> ---------------------------------------------------------------------
>> To start a new topic, e-mail: users@tomcat.apache.org
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To start a new topic, e-mail: users@tomcat.apache.org
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
>>
>>   
>>     
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
>
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
>
>   


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Incorrect cookie value in tomcat5.5.26

Posted by Sushil Vegad <vs...@serebrum.com>.
Hello Filip,

Please let me know your thoughts on this.

Our scenario is:
We set the username in the cookie when the user logs in. I open a new
browser instance, log-in and the cookie is set. If I logout of the
application and return to login screen (on the same browser instance) the
cookie is found.

PROBLEM:
If I use a NEW browser instance to go to the login page, the cookie is NOT
found. 

On login submit, we set the cookie - 
Cookie cookie = new Cookie(Constants.REMEMBERME, username);
cookie.setVersion(1);
cookie.setMaxAge(Integer.MAX_VALUE);
response.addCookie(cookie);


On requesting the login page, we check if the cookie was set - 

Cookie cookies[] = request.getCookies();
String username = "";
for (int i = 0; i < cookies.length; i++) {
Cookie c = cookies[i];
      if (c.getName().equals(Constants.REMEMBERME)) {
            username = c.getValue();//Set username in the login field
            break;
      }
}

This code did not have an issue with tomcat 5.0
Thanks,
Sushil
 

-----Original Message-----
From: Filip Hanik - Dev Lists [mailto:devlists@hanik.com] 
Sent: Monday, February 25, 2008 6:54 PM
To: Tomcat Users List
Subject: Re: Incorrect cookie value in tomcat5.5.26

what is your scenario,

the following code worked for me, even though the browser doesn't send 
up cookie version

<%
  javax.servlet.http.Cookie[] cs = request.getCookies();
  String value = null;
  for (Cookie co : cs) {
    if ("test".equals(co.getName())) value = co.getValue();
 
  }

  javax.servlet.http.Cookie c = new 
javax.servlet.http.Cookie("test","someemail=somedomain.com");
  c.setVersion(1);
  c.setMaxAge(1000000);
  response.addCookie(c);

%>
done!<br/>
<%=value%>



Sushil Vegad wrote:
> Hello,
>
> cookie.setVersion(1) remembers the cookie only for the browser session. A
> new browser does not have access to the cookie
>
> We did cookie.setMaxAge(Integer.MAX_VALUE) but that doesn't help.
>
> Any thoughts please?
>
> Thanks,
> Sushil Vegad
> Technical Lead, Scheduling Project
> Serebrum Corporation - translating strategy into results
> Work: 609.777.3563
> Cell: 732.216.4908      
> Email: vsushil@serebrum.com
> Conference Dial-in: 1-218-486-1300, Bridge: 427526
>  
>
> -----Original Message-----
> From: Filip Hanik - Dev Lists [mailto:devlists@hanik.com] 
> Sent: Monday, February 11, 2008 11:54 AM
> To: Tomcat Users List
> Subject: Re: Incorrect cookie value in tomcat5.5.26
>
> not broken, corrected. the java doc says
>
>
>       setValue
>
> public void *setValue*(String
> <http://java.sun.com/j2se/1.5/docs/api/java/lang/String.html> newValue)
>
>     Assigns a new value to a cookie after the cookie is created. If you
>     use a binary value, you may want to use BASE64 encoding.
>
>     With Version 0 cookies, values should not contain white space,
>     brackets, parentheses, equals signs, commas, double quotes, slashes,
>     question marks, at signs, colons, and semicolons. Empty values may
>     not behave the same way on all browsers.
>
>     *Parameters:*
>         |newValue| - a |String| specifying the new value
>
>
> to fix this, all you need to do is
>
> cookie.setVersion(1);
>
> Filip
>
> Konstantin Kolinko wrote:
>   
>> I guess the cause is the same as for tomcat 6.0.16.
>> See messages entitles "Cookies are broken in 6.0.16?".
>>
>> http://www.nabble.com/Cookies-are-broken-in-6.0.16--to15369118.html
>>
>> ---------------------------------------------------------------------
>> To start a new topic, e-mail: users@tomcat.apache.org
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
>>
>>   
>>     
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
>
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
>
>   


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org





---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Incorrect cookie value in tomcat5.5.26

Posted by Filip Hanik - Dev Lists <de...@hanik.com>.
what is your scenario,

the following code worked for me, even though the browser doesn't send 
up cookie version

<%
  javax.servlet.http.Cookie[] cs = request.getCookies();
  String value = null;
  for (Cookie co : cs) {
    if ("test".equals(co.getName())) value = co.getValue();
 
  }

  javax.servlet.http.Cookie c = new 
javax.servlet.http.Cookie("test","someemail=somedomain.com");
  c.setVersion(1);
  c.setMaxAge(1000000);
  response.addCookie(c);

%>
done!<br/>
<%=value%>



Sushil Vegad wrote:
> Hello,
>
> cookie.setVersion(1) remembers the cookie only for the browser session. A
> new browser does not have access to the cookie
>
> We did cookie.setMaxAge(Integer.MAX_VALUE) but that doesn't help.
>
> Any thoughts please?
>
> Thanks,
> Sushil Vegad
> Technical Lead, Scheduling Project
> Serebrum Corporation - translating strategy into results
> Work: 609.777.3563
> Cell: 732.216.4908      
> Email: vsushil@serebrum.com
> Conference Dial-in: 1-218-486-1300, Bridge: 427526
>  
>
> -----Original Message-----
> From: Filip Hanik - Dev Lists [mailto:devlists@hanik.com] 
> Sent: Monday, February 11, 2008 11:54 AM
> To: Tomcat Users List
> Subject: Re: Incorrect cookie value in tomcat5.5.26
>
> not broken, corrected. the java doc says
>
>
>       setValue
>
> public void *setValue*(String
> <http://java.sun.com/j2se/1.5/docs/api/java/lang/String.html> newValue)
>
>     Assigns a new value to a cookie after the cookie is created. If you
>     use a binary value, you may want to use BASE64 encoding.
>
>     With Version 0 cookies, values should not contain white space,
>     brackets, parentheses, equals signs, commas, double quotes, slashes,
>     question marks, at signs, colons, and semicolons. Empty values may
>     not behave the same way on all browsers.
>
>     *Parameters:*
>         |newValue| - a |String| specifying the new value
>
>
> to fix this, all you need to do is
>
> cookie.setVersion(1);
>
> Filip
>
> Konstantin Kolinko wrote:
>   
>> I guess the cause is the same as for tomcat 6.0.16.
>> See messages entitles "Cookies are broken in 6.0.16?".
>>
>> http://www.nabble.com/Cookies-are-broken-in-6.0.16--to15369118.html
>>
>> ---------------------------------------------------------------------
>> To start a new topic, e-mail: users@tomcat.apache.org
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
>>
>>   
>>     
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
>
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
>
>   


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Incorrect cookie value in tomcat5.5.26

Posted by Sushil Vegad <vs...@serebrum.com>.
Hello,

cookie.setVersion(1) remembers the cookie only for the browser session. A
new browser does not have access to the cookie

We did cookie.setMaxAge(Integer.MAX_VALUE) but that doesn't help.

Any thoughts please?

Thanks,
Sushil Vegad
Technical Lead, Scheduling Project
Serebrum Corporation - translating strategy into results
Work: 609.777.3563
Cell: 732.216.4908      
Email: vsushil@serebrum.com
Conference Dial-in: 1-218-486-1300, Bridge: 427526
 

-----Original Message-----
From: Filip Hanik - Dev Lists [mailto:devlists@hanik.com] 
Sent: Monday, February 11, 2008 11:54 AM
To: Tomcat Users List
Subject: Re: Incorrect cookie value in tomcat5.5.26

not broken, corrected. the java doc says


      setValue

public void *setValue*(String
<http://java.sun.com/j2se/1.5/docs/api/java/lang/String.html> newValue)

    Assigns a new value to a cookie after the cookie is created. If you
    use a binary value, you may want to use BASE64 encoding.

    With Version 0 cookies, values should not contain white space,
    brackets, parentheses, equals signs, commas, double quotes, slashes,
    question marks, at signs, colons, and semicolons. Empty values may
    not behave the same way on all browsers.

    *Parameters:*
        |newValue| - a |String| specifying the new value


to fix this, all you need to do is

cookie.setVersion(1);

Filip

Konstantin Kolinko wrote:
> I guess the cause is the same as for tomcat 6.0.16.
> See messages entitles "Cookies are broken in 6.0.16?".
>
> http://www.nabble.com/Cookies-are-broken-in-6.0.16--to15369118.html
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
>
>   


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org





---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Incorrect cookie value in tomcat5.5.26

Posted by Filip Hanik - Dev Lists <de...@hanik.com>.
not broken, corrected. the java doc says


      setValue

public void *setValue*(String <http://java.sun.com/j2se/1.5/docs/api/java/lang/String.html> newValue)

    Assigns a new value to a cookie after the cookie is created. If you
    use a binary value, you may want to use BASE64 encoding.

    With Version 0 cookies, values should not contain white space,
    brackets, parentheses, equals signs, commas, double quotes, slashes,
    question marks, at signs, colons, and semicolons. Empty values may
    not behave the same way on all browsers.

    *Parameters:*
        |newValue| - a |String| specifying the new value


to fix this, all you need to do is

cookie.setVersion(1);

Filip

Konstantin Kolinko wrote:
> I guess the cause is the same as for tomcat 6.0.16.
> See messages entitles "Cookies are broken in 6.0.16?".
>
> http://www.nabble.com/Cookies-are-broken-in-6.0.16--to15369118.html
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
>
>   


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Incorrect cookie value in tomcat5.5.26

Posted by Sushil Vegad <vs...@serebrum.com>.
Thanks Konstantin for you prompt response.

Is the solution identified? I don't find it anywhere on google.


-----Original Message-----
From: Konstantin Kolinko [mailto:knst.kolinko@gmail.com] 
Sent: Monday, February 11, 2008 11:25 AM
To: Tomcat Users List
Subject: Re: Incorrect cookie value in tomcat5.5.26

I guess the cause is the same as for tomcat 6.0.16.
See messages entitles "Cookies are broken in 6.0.16?".

http://www.nabble.com/Cookies-are-broken-in-6.0.16--to15369118.html

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org





---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Incorrect cookie value in tomcat5.5.26

Posted by Konstantin Kolinko <kn...@gmail.com>.
I guess the cause is the same as for tomcat 6.0.16.
See messages entitles "Cookies are broken in 6.0.16?".

http://www.nabble.com/Cookies-are-broken-in-6.0.16--to15369118.html

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Incorrect cookie value in tomcat5.5.26

Posted by Filip Hanik - Dev Lists <de...@hanik.com>.
we made a correction, if you read the javadoc, that is an invalid value 
for a v0 cookie.

do a cookie.setVersion(1);

Filip
Sushil Vegad wrote:
> Hello,
>
> We upgraded to tomcat 5.5.26 from 5.0.28 and now its returning incorrect
> cookie value.
>
>  
>
> We are setting user email/id in a cookie to remember the user, as follows
>
> Cookie cookie = new Cookie(Constants.COOKIE_NAME, "vsushil@serebrum.com");
>
>  
>
> On doing cookie.getValue(), tomcat 5.5.26 just returns vsushil instead of
> the whole string. Since some of our code was written on JDK 1.4, we
> installed the JDK 4 compatibility package for tomcat5.5.26 
>
>  
>
> Please let me know the possible options to fix this.
>
>  
>
> Thanks,
>
> Sushil Vegad
>
> Technical Lead, Scheduling Project
>
> Serebrum Corporation - translating strategy into results
>
> Work: 609.777.3563
>
> Cell: 732.216.4908      
>
> Email: vsushil@serebrum.com
>
> Conference Dial-in: 1-218-486-1300, Bridge: 427526
>
>  
>
>
>   
> ------------------------------------------------------------------------
>
> No virus found in this incoming message.
> Checked by AVG Free Edition. 
> Version: 7.5.516 / Virus Database: 269.20.2/1271 - Release Date: 2/11/2008 8:16 AM
>   


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org