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 11:47:29 -0700
On Sep 28, 2005, at 11:14 AM, Arturo Perez wrote:
Chuck Hill wrote:
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."
Hi Chuck,
This is along the lines of a shoulda/woulda/coulda. But, shouldn't
WO return the string "WA" if there is only one cookie with that key?
I think that you could make a reasonable argument for that behavior,
or just returning the NSArray so that we could do
curStateName = ((NSArray)cookie.value()).objectAtIndex(0);
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