Before, I was noticing the cookie getting set when I did Edit->Preferences.
Later I did not, and I noticed my machine was blocked from setting cookies.
I removed the block, tried again and later it was blocked again. I was 
originally
removing the cookie and maybe that made Firefox think I wanted to block it.
Anyway, even when the cookie was being set it wasn't being found.

I tried the path thing but that didn't seem to work either. Even if I tried 
cookie.getPath() and
then set the kill cookie's path.

So I just made a string SpecialLoginCookiePath = "/dmaconf" and used that for 
all the paths.
I think that works now. It seems to. And the deleting seems to work now. The 
frustrating
thing is, when you change your jsp code, save it, even when you do SHIFT-RELOAD 
and
clear your cache it still has remnants of the old code and reports problems 
that you have fixed
already.

I am going to try that live http headers.

-----Original Message-----
From: Christopher Schultz [mailto:[EMAIL PROTECTED]
Sent: Monday, August 6, 2007 05:01 PM
To: 'Tomcat Users List'
Subject: Re: cookies

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Tony,

[EMAIL PROTECTED] wrote:
> I just did a responses to this and somehow it got lost ;-(

I hate it when that happens. :(

> Cookie oreo;

Very clever ;)

That code looks fine, by the way. The fact that cookies.length is 1
probably means that the cookie was never sent, rather than you writing
bad code. Your code looks fine, too. I was looking to see if you did
anything like if(cookie.getName() == "UserLevel") which, of course,
wouldn't work.

> You can see I have a couple debug statements. Length is 1
> and the only cookie is JSESSIONID 034B86006263B7E9E68EE7A660DC728E.
> Though I do see it in the catalina log and the edit->preferences (UserLevel 
> 0).

What does that mean?

> The cookie-setting is not mine, but rather the person who left. It is kind of 
> complicated
> so I will just show the relative parts (you can ignore the else part). As I 
> said it shows up
> in the log file and edit->preference
> 
> if(err.errcode == 0){
> Cookie cok = new Cookie("UserLevel",sUserLevel);
> System.out.println( "Added COOKIE UserLevel: " + sUserLevel );
> response.addCookie(cok);

Hmm... no "path" set on the cookie.

Did you verify that the cookie is being sent to the client correctly
(after the addCookie call above)? Use something like LiveHTTPHeaders, or
even the RequestDumperValve on the server-side to see what's up.

For good measure, you might want to modify the cookie-setting code to do
this:

Cookie cok = new Cookie("UserLevel", sUserLevel);
cok.setPath(request.getContextPath());
response.addCookie(cok);

The servlet API doesn't require the path, but doesn't say what the
default path is. Perhaps it is effectively "/". Observation of the
request and response headers will be requires in order to understand
what's going on.

- -chris

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGt4w/9CaO5/Lv0PARAu6kAJ4mbMDU2cEiTCd3ZTmpOKKgYWyoogCeK4Ds
gJZ6IWEJxTbjuEpYaTDh+Dg=
=i1q5
-----END PGP SIGNATURE-----

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


Reply via email to