Re: Adding cookies in a DA method
Re: Adding cookies in a DA method
- Subject: Re: Adding cookies in a DA method
- From: Chuck Hill <email@hidden>
- Date: Thu, 19 Oct 2006 10:24:50 -0700
Hi Kieran,
On Oct 19, 2006, at 8:42 AM, Kieran Kelleher wrote:
Thanks Mark and Chuck. Working now. calling generateResponse() on
the DirectAction results, adding the cookie and then returning the
result of generate response was the key.
I am curioius: where did you have the call to addCookie() orginally?
It should have worked in appendToResponse().
The interesting neat thing is that I did not realize that
WOResponse implements WOActionResults and
WOResponse.generateResponse just returns itself. Not a week goes by
where I am still not impressed by the thoughtful design aspects of
WebObjects.
It is also useful to have
return page.generateResponse();
instead of just
return page;
in your direct actions. If you use the latter, and an exception is
thrown when the frameworks call generateResponse(), the exception is
not handled correctly. The former allows the DA exception handling
to catch these.
Chuck
Regards, Kieran
On Oct 19, 2006, at 12:07 AM, Mark Morris wrote:
Hi Kieran,
Whatever you're returning from the DA implements WOActionResults,
so you can generateResponse and add the cookies to the resulting
WOResponse object. If you're returning a WOComponent, you could
still use the returnPage.context().response().addCookie(...)
technique before you actually return it.
Regards,
Mark
On Oct 18, 2006, at 10:40 PM, Kieran Kelleher wrote:
Hi,
Adding cookies using context().response().addCookie( ... ) in a
WOComponent is fine, but how do you add a cookie in a
WODirectAction action?
Regards, Kieran
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40global-village.net
This email sent to email@hidden
--
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