Herchel,
Herchel,
Looks to me like you are not writing the old cookie back to the user
after changing it.
You have to use
response.addCookie( c);
after you have changed its value.
(and move the scope of Cookie c; out to cover all of the code, not
have it in the loop).
Chris
Evesham
England
BTW - something strange with your message. Locks up my Outlook Express
when I try to reply.
--------------------
I hava JDBCRealm auth, and want to store user's last_accessed time. i
thought cookies would be good for that. my code is as follows:
Locale l = new Locale("pl","PL","UNIX");
String user = request.getRemoteUser();
String data="";
boolean found = false;
Cookie[] cookies = request.getCookies();
for (int i = 0; i < cookies.length; i++) {
Cookie c = cookies[i];
if (c.getName().equals(user)) {
found=true;
data = c.getValue();
c.setValue(DateFormat.getDateTimeInstanceDateFormat.LONG,DateFormat.LO
NG,l).
format(new Date()));
}
}
if (!found) {
String bla =
DateFormat.getDateTimeInstance(DateFormat.LONG,DateFormat.LONG,l).form
at(new
Date());
Cookie newC = new Cookie(request.getRemoteUser(),bla);
newC.setMaxAge(100000);
response.addCookie(newC);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]