• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: WOCookie - replacing/removing?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: WOCookie - replacing/removing?


  • Subject: Re: WOCookie - replacing/removing?
  • From: David Griffith <email@hidden>
  • Date: Wed, 03 Mar 2004 18:34:25 +0100

Benjamin,

Just looking again at your code below, if the path is the same, will it
replace the cookie?  The reason I ask is that at the moment I am getting
multiple cookies added with the same Language - is this because I have not
set the path the same for each do you think?

Dave.
> You can get the cookie sent by the browser from the WORequest - using
> context().request() from a component. I normally send an expired cookie
> with the same path and name to the browser to remove a cookie.
>
>
> ------
>
> public void appendToResponse(WOResponse response, WOContext context) {
>
> if (saveSettings()) {
>
> // save the user's email address
> WOCookie emailCookie = new WOCookie( "email",
> (String)session.user.preferences().valueForKey("kWSLoginEmailAddress")
> );
> emailCookie.setPath("/");
>
> // set the expiration date
> NSTimestamp expires = new
> NSTimestamp().timestampByAddingGregorianUnits(1, 0, 0, 0, 0, 0);
> emailCookie.setExpires(expires);
>
> // add the cookie to the response
> response.addCookie(emailCookie);
>
> } else {
>
> // send expired cookies to clear the older cookies from the user's disk
> as they do not want to save login settings
> WOCookie emailCookie = new WOCookie("email", "none");
> emailCookie.setPath("/");
>
> // set the expiration date to a year ago
> NSTimestamp expires = new
> NSTimestamp().timestampByAddingGregorianUnits(-1, 0, 0, 0, 0, 0);
> emailCookie.setExpires(expires);
>
> // add the cookie
> response.addCookie(emailCookie);
> }
>
> super.appendToResponse(response, context);
> }
>
>
>
> Benjamin
>
>
>
>
> On Wednesday, March 3, 2004, at 01:50  pm,
> email@hidden wrote:
>
>> Once I add a cookie, and it gets stored on the browser, can I replace
>> it
>> with a new value or remove it and re-add it?  Not sure how to do this.
>>  Have
>> seen the removeCookie(WOCookie cookie) method, but is this what I
>> need, and
>> if so, how do I get the WOCookie to pass to this?
>
>
> Benjamin Miller, Digital Developer
> Watershed Media Centre
> 1 Canon's Road, Harbourside, Bristol, UK. BS1 5TX
> t: +44 (0)117 927 6444, f: +44(0)117 921 3958
> http://www.watershed.co.uk
> iChat/AIM: email@hidden
>
> --
> What's a meaningful and engaging web experience?
> Join in the debate at - http://www.dshed.net/digest
> _______________________________________________
> 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.
_______________________________________________
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.


References: 
 >Re: WOCookie - replacing/removing? (From: Benjamin Miller <email@hidden>)

  • Prev by Date: Re: WOCookie - replacing/removing?
  • Next by Date: Re: WOCookie - replacing/removing?
  • Previous by thread: Re: WOCookie - replacing/removing?
  • Next by thread: Re: WOCookie - replacing/removing?
  • Index(es):
    • Date
    • Thread