Re: how to set a cookie in a WORedirect ?
Re: how to set a cookie in a WORedirect ?
- Subject: Re: how to set a cookie in a WORedirect ?
- From: Alex Johnson <email@hidden>
- Date: Sat, 30 Jul 2005 20:36:29 -0700
Hi Gavin (long time no see) --
Would this work for you? >>
<x-tad-bigger>public WOActionResults myAction() {
WORedirect redirect = (WORedirect)app.pageWithName ("WORedirect", ...);
redirect.setUrl ("https://weblogin.umich.edu/cgi-bin/logout");
WOResponse response = redirect.generateResponse();
WOCookie cookie = new WOCookie("xxx", "yyy", "", "", new NSTimestamp(new java.util.Date(0L)), true);
response.addCookie(cookie);
return response;
}
</x-tad-bigger>
If you need to pass that redirect back to some other code, you could add the cookie behavior to a subclass of WORedirect and instantiate that instead.
HTH
Alex Johnson
|
| |
|||
|| | |
||
| | |
|| || |
||
\\ SITE 9 \\ SITE9.COM \\ 503.248.4440 \\
On Jul 30, 2005, at 3:52 PM, Gavin Eadie wrote:
I must be missing something obvious but I'm having a lot of trouble setting a cookie in the headers of a WORedirect. I can extract the response and its headers from the WORedirect:
WORedirect redirect = app.pageWithName ("WORedirect", ...);
redirect.setUrl (https://weblogin.umich.edu/cgi-bin/logout);
NSLog.out.applendln( "resp-headers: " + redirect.generateResponse().headers());
and I can set a cookie on the response:
WOCookie cookie = new WOCookie("xxx", "yyy", "", "",
new NSTimestamp(new java.util.Date(0L)), true);
redirect.generateResponse().addCookie(cookie);
but the WOResponse obtained by generateResponse() is a copy of the WOResponse data, not a reference to it, and I cannot figure how to directly manipulate the WORedirect's response or replace it by a manipulated copy. As I said this must be pretty simple but I have searched hard and have hit a blind spot ... thanks for any help.
_______________________________________________
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
_______________________________________________
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