Re: WOCookie value() returns quoted/parenthesized string not string
Re: WOCookie value() returns quoted/parenthesized string not string
- Subject: Re: WOCookie value() returns quoted/parenthesized string not string
- From: Chuck Hill <email@hidden>
- Date: Wed, 28 Sep 2005 10:40:04 -0700
On Sep 28, 2005, at 10:25 AM, Baiss Eric Magnusson wrote:
When I look at the cookie and when I set it, the value is <WA>
But when I do:
cookie = (WOCookie)allCookies.objectAtIndex(i);
if ( cookie.name().equals("state")) curStateName =
cookie.value();
I see in the log
setRegionFromCookies-> 0 ** <com.webobjects.appserver.WOCookie
name=state value=("WA") path=null domain=null isSecure=false>
and curStateName is <("WA")> not <WA>, which means everything fails
from that point on.
When working with WO it is important to keep in mind that ("...",
"...") is a serialized array and that {"..."="...";} is a serialized
dictionary. The docs for WOCookie.value state: "This value attribute
is similar to the value of a dictionary or hash table."
So, what you have above is a serialized array. The reasoning behind
this is that the spec allows for multiple cookies with the same
name. You could de-serialize this into an NSArray and get the first
object, or use the WORequest method
curStateName = request().cookieValueForKey("state");
which "Returns the first value in the request for the given cookie
name as specified by aKey."
HTH
Chuck
--
Coming in 2006 - an introduction to web applications using WebObjects
and Xcode http://www.global-village.net/wointro
Practical WebObjects - for developers who want to increase their
overall knowledge of WebObjects or who are trying to solve specific
problems. http://www.global-village.net/products/practical_webobjects
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden