Re: StringIndexOutOfBoundsException and cookies
Re: StringIndexOutOfBoundsException and cookies
- Subject: Re: StringIndexOutOfBoundsException and cookies
- From: Chuck Hill <email@hidden>
- Date: Mon, 19 Jan 2004 14:20:49 -0800
- Organization: Global Village Consulting, Inc.
Hi Kaj,
Try this:
The easiest fix is as follows, in Application.java:
public WOResponse dispatchRequest(WORequest request) {
String cookieHeader = request.headerForKey("cookie");
if (cookieHeader != null && /* cookie not ok */) {
String newCookie = /* Fix cookie here */;
request.setHeader(URLEncoder.encode(newCookie, "cookie");
}
return super.dispatchRequest(request);
}
Adapted from code originally posted by:
Christopher Legan, Ph.D.
cklegan of king.net
Partner, Kiwi InterNet Group, Inc.
http://www.king.net
Chuck
Kaj Hejer wrote:
At 16:34 -0500 19-01-04, arturo wrote:
----- Original Message -----
From: "Kaj Hejer" <email@hidden>
We get some more info:
> Application.handleMalformedCookieString:cookieString:
edmode=1; tittel=Nye bxker i sosiologi juni 2003;
tema=bibliotek; enhet.id=humsam; spraak=no-bok;
redaksjon.navn=Kaj Hejer;
redaksjon.epost=email@hidden;
redaksjon.vev=
Are you URL-encoding your cookie values? I remember (vaguely) that
when we
switched
versions of WO, and/or TomCat and/or Apache that the cookies went from
being
automatically
url-encoded to not being automatically url-encoded.
So, if the above is a raw cookie string dump then it is a malformed
cookie.
Cookie values, unless
encoded, may not contain spaces and a bunch of other things. So, try
encoding and decoding
and hopefull that will fix your problem.
Hi!
Thanks for answering!
NOW we do URL-encoding our cookie values :) but we didn't do this
ealier. I guess there are some of the old cookies this app used (in the
WO4.5.1 version) that now is the source of this problems (only a few
users see this issue and it seems to be the users who used the WO4.5.1
version of this app).
The question is how to remove any bad cookies and just keep the cookies
that is ok if WO find a bad cookie (which I guess it does when throwing
a StringIndexOutOfBoundsException).
-Kaj :)
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.
--
Chuck Hill email@hidden
Global Village Consulting Inc. http://www.global-village.net
It is a funny thing about life; if you refuse to accept
anything but the best, you very often get it."
-- W. Somerset Maugham
<shamelessPlug>
Practical WebObjects
http://www.amazon.com/exec/obidos/tg/detail/-/1590592964
</shamelessPlug>
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.