Re: forcing cookies to expire

2008-06-11 Thread Jeremy Thomerson
I know this doesn't relate to your question, and I don't know what your app
is at all, but does this cookie automatically log someone in to your app if
they come back later?  If so, you probably don't want to use the username
for that.  Then I can just pick someone else's username, fake my cookie, and
come to the app and be logged in as them.

You're probably not doing that - maybe you're just using it like Josh was -
to prefill a username field - but I would've felt remiss if I didn't mention
it.  :)

On Wed, Jun 11, 2008 at 10:13 AM, jchappelle <[EMAIL PROTECTED]> wrote:

>
> I don't have to have it set on root. In fact now my code doesn't call
> setPath
> at all and it works fine.
>
> This is actually my first time ever using cookies. I've developed
> traditional applications in the past. I really only need the cookie to be
> visible to my login page but it doesn't really hurt if it is visible to any
> other pages because this is the only place(as of now) that we use cookies
> in
> our product.
>
> How would I specify the path so that only my login page would be visible?
> Since this is wicket and the URL paths are weird I don't really know how I
> would do that.
>
> Thanks,
>
> Josh
>
> Johan Compagner wrote:
> >
> > Because we cant really just call set path... That is something that
> > you have to do. Why do you want it on root?
> >
> > On 6/10/08, jchappelle <[EMAIL PROTECTED]> wrote:
> >>
> >> Thanks for the quick reply. I finally fixed the problem. What I found
> was
> >> that when I was creating my cookie I was calling setPath("/") and when I
> >> deleted it I was not calling setPath("/"). So I guess the equals method
> >> saw
> >> them as two different cookies and it wasn't deleting it. There is
> >> actually a
> >> convenience method on the WebResponse class called clearCookie that I am
> >> calling. However, that method will not work if you have called
> >> setPath("/")
> >> on your cookie because it doesn't set the path. It just does the
> >> following:
> >>
> >>  public void clearCookie(final Cookie cookie)
> >>  {
> >>  if (httpServletResponse != null)
> >>  {
> >>  cookie.setMaxAge(0);
> >>  cookie.setValue(null);
> >>  addCookie(cookie);
> >>  }
> >>  }
> >>
> >> Thanks,
> >>
> >> Josh
> >>
> >>
> >> richardwilko wrote:
> >>>
> >>> Ive had the same problem.  to delete a cookie do this:
> >>>
> >>> Cookie newCookie = new Cookie("my cookie name here!", null);
> >>> newCookie.setMaxAge(0);
> >>> newCookie.setPath("/");
> >>> getWebRequestCycle().getWebResponse().addCookie(newCookie);
> >>>
> >>> i dont know why (i didnt really look into it) but u seem to have to
> >>> create
> >>> a new cookie with the same name and add it.  maybe this is a wicket
> bug?
> >>>
> >>> Richard
> >>>
> >>
> >> --
> >> View this message in context:
> >>
> http://www.nabble.com/forcing-cookies-to-expire-tp17067292p17760587.html
> >> Sent from the Wicket - User mailing list archive at Nabble.com.
> >>
> >>
> >> -
> >> To unsubscribe, e-mail: [EMAIL PROTECTED]
> >> For additional commands, e-mail: [EMAIL PROTECTED]
> >>
> >>
> >
> > -
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/forcing-cookies-to-expire-tp17067292p17780251.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


-- 
Jeremy Thomerson
http://www.wickettraining.com


Re: forcing cookies to expire

2008-06-11 Thread jchappelle

I don't have to have it set on root. In fact now my code doesn't call setPath
at all and it works fine.

This is actually my first time ever using cookies. I've developed
traditional applications in the past. I really only need the cookie to be
visible to my login page but it doesn't really hurt if it is visible to any
other pages because this is the only place(as of now) that we use cookies in
our product.

How would I specify the path so that only my login page would be visible?
Since this is wicket and the URL paths are weird I don't really know how I
would do that. 

Thanks,

Josh

Johan Compagner wrote:
> 
> Because we cant really just call set path... That is something that
> you have to do. Why do you want it on root?
> 
> On 6/10/08, jchappelle <[EMAIL PROTECTED]> wrote:
>>
>> Thanks for the quick reply. I finally fixed the problem. What I found was
>> that when I was creating my cookie I was calling setPath("/") and when I
>> deleted it I was not calling setPath("/"). So I guess the equals method
>> saw
>> them as two different cookies and it wasn't deleting it. There is
>> actually a
>> convenience method on the WebResponse class called clearCookie that I am
>> calling. However, that method will not work if you have called
>> setPath("/")
>> on your cookie because it doesn't set the path. It just does the
>> following:
>>
>>  public void clearCookie(final Cookie cookie)
>>  {
>>  if (httpServletResponse != null)
>>  {
>>  cookie.setMaxAge(0);
>>  cookie.setValue(null);
>>  addCookie(cookie);
>>  }
>>  }
>>
>> Thanks,
>>
>> Josh
>>
>>
>> richardwilko wrote:
>>>
>>> Ive had the same problem.  to delete a cookie do this:
>>>
>>> Cookie newCookie = new Cookie("my cookie name here!", null);
>>> newCookie.setMaxAge(0);
>>> newCookie.setPath("/");
>>> getWebRequestCycle().getWebResponse().addCookie(newCookie); 
>>>
>>> i dont know why (i didnt really look into it) but u seem to have to
>>> create
>>> a new cookie with the same name and add it.  maybe this is a wicket bug?
>>>
>>> Richard
>>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/forcing-cookies-to-expire-tp17067292p17760587.html
>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>
>>
>> -
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/forcing-cookies-to-expire-tp17067292p17780251.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: forcing cookies to expire

2008-06-11 Thread Johan Compagner
Because we cant really just call set path... That is something that
you have to do. Why do you want it on root?

On 6/10/08, jchappelle <[EMAIL PROTECTED]> wrote:
>
> Thanks for the quick reply. I finally fixed the problem. What I found was
> that when I was creating my cookie I was calling setPath("/") and when I
> deleted it I was not calling setPath("/"). So I guess the equals method saw
> them as two different cookies and it wasn't deleting it. There is actually a
> convenience method on the WebResponse class called clearCookie that I am
> calling. However, that method will not work if you have called setPath("/")
> on your cookie because it doesn't set the path. It just does the following:
>
>   public void clearCookie(final Cookie cookie)
>   {
>   if (httpServletResponse != null)
>   {
>   cookie.setMaxAge(0);
>   cookie.setValue(null);
>   addCookie(cookie);
>   }
>   }
>
> Thanks,
>
> Josh
>
>
> richardwilko wrote:
>>
>> Ive had the same problem.  to delete a cookie do this:
>>
>> Cookie newCookie = new Cookie("my cookie name here!", null);
>> newCookie.setMaxAge(0);
>> newCookie.setPath("/");
>> getWebRequestCycle().getWebResponse().addCookie(newCookie);  
>>
>> i dont know why (i didnt really look into it) but u seem to have to create
>> a new cookie with the same name and add it.  maybe this is a wicket bug?
>>
>> Richard
>>
>
> --
> View this message in context:
> http://www.nabble.com/forcing-cookies-to-expire-tp17067292p17760587.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: forcing cookies to expire

2008-06-10 Thread jchappelle

Thanks for the quick reply. I finally fixed the problem. What I found was
that when I was creating my cookie I was calling setPath("/") and when I
deleted it I was not calling setPath("/"). So I guess the equals method saw
them as two different cookies and it wasn't deleting it. There is actually a
convenience method on the WebResponse class called clearCookie that I am
calling. However, that method will not work if you have called setPath("/")
on your cookie because it doesn't set the path. It just does the following:

public void clearCookie(final Cookie cookie)
{
if (httpServletResponse != null)
{
cookie.setMaxAge(0);
cookie.setValue(null);
addCookie(cookie);
}
}

Thanks,

Josh


richardwilko wrote:
> 
> Ive had the same problem.  to delete a cookie do this:
> 
> Cookie newCookie = new Cookie("my cookie name here!", null);
> newCookie.setMaxAge(0);
> newCookie.setPath("/");
> getWebRequestCycle().getWebResponse().addCookie(newCookie);   
> 
> i dont know why (i didnt really look into it) but u seem to have to create
> a new cookie with the same name and add it.  maybe this is a wicket bug?
> 
> Richard
> 

-- 
View this message in context: 
http://www.nabble.com/forcing-cookies-to-expire-tp17067292p17760587.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: forcing cookies to expire

2008-06-10 Thread richardwilko

Ive had the same problem.  to delete a cookie do this:

Cookie newCookie = new Cookie("my cookie name here!", null);
newCookie.setMaxAge(0);
newCookie.setPath("/");
getWebRequestCycle().getWebResponse().addCookie(newCookie); 

i dont know why (i didnt really look into it) but u seem to have to create a
new cookie with the same name and add it.  maybe this is a wicket bug?

Richard
-- 
View this message in context: 
http://www.nabble.com/forcing-cookies-to-expire-tp17067292p17758907.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: forcing cookies to expire

2008-06-10 Thread jchappelle

I am having the same problem. On my login page there is a "remember me"
checkbox and if the user clicks and then submits the login page then the
cookie is successfully stored. However if they arive to the page and they
already have that cookie(it just pre-fills the username field) then they are
allowed to unclick the box and then submit the form so that it will remove
the cookie. However, this is not working. Here is my code:

private void rememberMe()
{
Cookie cookie = getRememberMeCookie();
if(cookie == null)
{
cookie = new Cookie("PACKET_TRACKER_USERNAME", 
userName);
}
cookie.setPath("/");
cookie.setMaxAge(Integer.MAX_VALUE);

((WebResponse)getRequestCycle().getResponse()).addCookie(cookie);   

}

private void forgetMe()
{
Cookie cookie = getRememberMeCookie();
if(cookie != null)
{
cookie.setMaxAge(0);

((WebResponse)getRequestCycle().getResponse()).addCookie(cookie);
}
}

private Cookie getRememberMeCookie()
{
Cookie[] cookies =
((WebRequest)getRequestCycle().getRequest()).getCookies();
if(cookies != null)
{
for(int i = 0; i < cookies.length; i++)
{

if(cookies[i].getName().equalsIgnoreCase("MYAPP_USERNAME"))
{
return cookies[i];
}
}
}
return null;
}


Johan Compagner wrote:
> 
> i have no idea then what goes wrong
> especially if it is just one request not a redirect one.
> 
> you could try to clean the cookes by directly using the httpresponseobject
> yes.
> Just that that one from the WebResponse
> 
> johan
> 
> 
> On Wed, May 7, 2008 at 5:00 PM, Andrew Broderick <
> [EMAIL PROTECTED]> wrote:
> 
>> Tried that, and it didn't make any difference
>> (getRequestCycle().setRedirect(false)).
>>
>> The page is called via a BookmarkablePageLink. Debugging reveals that the
>> constructor, below, is called every time the link is clicked, so it isn't
>> an
>> issue of the code not being called. I also tried calling it via a
>>  as well - no dice.
>>
>> Earlier, someone mentioned something about "pushing" to the
>> HttpServletResponse object. What does this mean, exactly?
>>
>> Thanks
>>
>> -Original Message-
>> From: Johan Compagner [mailto:[EMAIL PROTECTED]
>> Sent: Wednesday, May 07, 2008 2:24 AM
>> To: users@wicket.apache.org
>> Subject: Re: forcing cookies to expire
>>
>> how is that page called/created?
>>
>> if you do this:
>>
>>   public SignOut()
>>   {
>>   clearCookie(Register.REMEMBER_ME_COOKIE);
>>   getSession().invalidate();
>>   getRequestCycle().setRedirct(false)
>>}
>>
>> what then
>>
>> On Tue, May 6, 2008 at 4:16 PM, Andrew Broderick <
>> [EMAIL PROTECTED]> wrote:
>>
>> > Hi,
>> >
>> > clearCookie() is called in the constructor of a page called SignOut.
>> The
>> > entire constructor is:
>> >
>> >public SignOut()
>> >{
>> >        clearCookie(Register.REMEMBER_ME_COOKIE);
>> >getSession().invalidate();
>> >}
>> >
>> > As I mentioned the cookie is never cleared. Is there something else I
>> need
>> > to do?
>> >
>> > Thanks
>> >
>> > -Original Message-
>> > From: Johan Compagner [mailto:[EMAIL PROTECTED]
>> > Sent: Monday, May 05, 2008 5:58 PM
>> > To: users@wicket.apache.org
>> > Subject: Re: forcing cookies to expire
>> >
>> > When is that clear cookie called?
>> > Can you follow that call a bit more, is it pushed to the
>> > httpservletresponse object?
>> >
>> > On 5/5/08, Andrew Broderick <[EMAIL PROTECTED]> wrote:
>> > > Hi,
>> > >
>> > > I am trying

Re: forcing cookies to expire

2008-05-08 Thread Johan Compagner
i have no idea then what goes wrong
especially if it is just one request not a redirect one.

you could try to clean the cookes by directly using the httpresponseobject
yes.
Just that that one from the WebResponse

johan


On Wed, May 7, 2008 at 5:00 PM, Andrew Broderick <
[EMAIL PROTECTED]> wrote:

> Tried that, and it didn't make any difference
> (getRequestCycle().setRedirect(false)).
>
> The page is called via a BookmarkablePageLink. Debugging reveals that the
> constructor, below, is called every time the link is clicked, so it isn't an
> issue of the code not being called. I also tried calling it via a
>  as well - no dice.
>
> Earlier, someone mentioned something about "pushing" to the
> HttpServletResponse object. What does this mean, exactly?
>
> Thanks
>
> -Original Message-
> From: Johan Compagner [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, May 07, 2008 2:24 AM
> To: users@wicket.apache.org
> Subject: Re: forcing cookies to expire
>
> how is that page called/created?
>
> if you do this:
>
>   public SignOut()
>   {
>   clearCookie(Register.REMEMBER_ME_COOKIE);
>   getSession().invalidate();
>   getRequestCycle().setRedirct(false)
>}
>
> what then
>
> On Tue, May 6, 2008 at 4:16 PM, Andrew Broderick <
> [EMAIL PROTECTED]> wrote:
>
> > Hi,
> >
> > clearCookie() is called in the constructor of a page called SignOut. The
> > entire constructor is:
> >
> >public SignOut()
> >{
> >clearCookie(Register.REMEMBER_ME_COOKIE);
> >getSession().invalidate();
> >}
> >
> > As I mentioned the cookie is never cleared. Is there something else I
> need
> > to do?
> >
> > Thanks
> >
> > -Original Message-
> > From: Johan Compagner [mailto:[EMAIL PROTECTED]
> > Sent: Monday, May 05, 2008 5:58 PM
> > To: users@wicket.apache.org
> > Subject: Re: forcing cookies to expire
> >
> > When is that clear cookie called?
> > Can you follow that call a bit more, is it pushed to the
> > httpservletresponse object?
> >
> > On 5/5/08, Andrew Broderick <[EMAIL PROTECTED]> wrote:
> > > Hi,
> > >
> > > I am trying to manage cookies in Wicket. I can create them and read
> them
> > no
> > > problem, but forcing expiry by setting maxAge=0 does not seem to be
> > working.
> > > Here is the code:
> > >
> > > Set cookie:
> > >
> > >   public void setRememberMeCookie(String username)
> > >   {
> > > Cookie cookie = new Cookie(REMEMBER_ME_COOKIE, username);
> > > cookie.setMaxAge(-1);
> > > cookie.setPath("/");
> > > getWebRequestCycle().getWebResponse().addCookie(cookie);
> > >   }
> > >
> > > Clear cookie:
> > >
> > >   private void clearCookie(String name)
> > >   {
> > > Cookie cookie =
> > > getWebRequestCycle().getWebRequest().getCookie(name);
> > > cookie.setMaxAge(0);
> > > getWebRequestCycle().getWebResponse().addCookie(cookie);
> > >   }
> > >
> > > The code is definitely called. However, the cookie remains. What am I
> > doing
> > > wrong?
> > >
> > > Thanks
> > >
> > > ___
> > >
> > > The  information in this email or in any file attached
> > > hereto is intended only for the personal and confiden-
> > > tial  use  of  the individual or entity to which it is
> > > addressed and may contain information that is  propri-
> > > etary  and  confidential.  If you are not the intended
> > > recipient of this message you are hereby notified that
> > > any  review, dissemination, distribution or copying of
> > > this message is strictly prohibited.  This  communica-
> > > tion  is  for information purposes only and should not
> > > be regarded as an offer to sell or as  a  solicitation
> > > of an offer to buy any financial product. Email trans-
> > > mission cannot be guaranteed to be  secure  or  error-
> > > free. P6070214
> > >
> >
> > -
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> > -
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


RE: forcing cookies to expire

2008-05-07 Thread Andrew Broderick
Tried that, and it didn't make any difference 
(getRequestCycle().setRedirect(false)).

The page is called via a BookmarkablePageLink. Debugging reveals that the 
constructor, below, is called every time the link is clicked, so it isn't an 
issue of the code not being called. I also tried calling it via a  
as well - no dice.

Earlier, someone mentioned something about "pushing" to the HttpServletResponse 
object. What does this mean, exactly?

Thanks

-Original Message-
From: Johan Compagner [mailto:[EMAIL PROTECTED]
Sent: Wednesday, May 07, 2008 2:24 AM
To: users@wicket.apache.org
Subject: Re: forcing cookies to expire

how is that page called/created?

if you do this:

   public SignOut()
   {
   clearCookie(Register.REMEMBER_ME_COOKIE);
   getSession().invalidate();
   getRequestCycle().setRedirct(false)
}

what then

On Tue, May 6, 2008 at 4:16 PM, Andrew Broderick <
[EMAIL PROTECTED]> wrote:

> Hi,
>
> clearCookie() is called in the constructor of a page called SignOut. The
> entire constructor is:
>
>public SignOut()
>{
>clearCookie(Register.REMEMBER_ME_COOKIE);
>getSession().invalidate();
>}
>
> As I mentioned the cookie is never cleared. Is there something else I need
> to do?
>
> Thanks
>
> -Original Message-
> From: Johan Compagner [mailto:[EMAIL PROTECTED]
> Sent: Monday, May 05, 2008 5:58 PM
> To: users@wicket.apache.org
> Subject: Re: forcing cookies to expire
>
> When is that clear cookie called?
> Can you follow that call a bit more, is it pushed to the
> httpservletresponse object?
>
> On 5/5/08, Andrew Broderick <[EMAIL PROTECTED]> wrote:
> > Hi,
> >
> > I am trying to manage cookies in Wicket. I can create them and read them
> no
> > problem, but forcing expiry by setting maxAge=0 does not seem to be
> working.
> > Here is the code:
> >
> > Set cookie:
> >
> >   public void setRememberMeCookie(String username)
> >   {
> > Cookie cookie = new Cookie(REMEMBER_ME_COOKIE, username);
> > cookie.setMaxAge(-1);
> > cookie.setPath("/");
> > getWebRequestCycle().getWebResponse().addCookie(cookie);
> >   }
> >
> > Clear cookie:
> >
> >   private void clearCookie(String name)
> >   {
> > Cookie cookie =
> > getWebRequestCycle().getWebRequest().getCookie(name);
> > cookie.setMaxAge(0);
> > getWebRequestCycle().getWebResponse().addCookie(cookie);
> >   }
> >
> > The code is definitely called. However, the cookie remains. What am I
> doing
> > wrong?
> >
> > Thanks
> >
> > ___
> >
> > The  information in this email or in any file attached
> > hereto is intended only for the personal and confiden-
> > tial  use  of  the individual or entity to which it is
> > addressed and may contain information that is  propri-
> > etary  and  confidential.  If you are not the intended
> > recipient of this message you are hereby notified that
> > any  review, dissemination, distribution or copying of
> > this message is strictly prohibited.  This  communica-
> > tion  is  for information purposes only and should not
> > be regarded as an offer to sell or as  a  solicitation
> > of an offer to buy any financial product. Email trans-
> > mission cannot be guaranteed to be  secure  or  error-
> > free. P6070214
> >
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: forcing cookies to expire

2008-05-07 Thread Johan Compagner
how is that page called/created?

if you do this:

   public SignOut()
   {
   clearCookie(Register.REMEMBER_ME_COOKIE);
   getSession().invalidate();
   getRequestCycle().setRedirct(false)
}

what then

On Tue, May 6, 2008 at 4:16 PM, Andrew Broderick <
[EMAIL PROTECTED]> wrote:

> Hi,
>
> clearCookie() is called in the constructor of a page called SignOut. The
> entire constructor is:
>
>public SignOut()
>{
>clearCookie(Register.REMEMBER_ME_COOKIE);
>getSession().invalidate();
>}
>
> As I mentioned the cookie is never cleared. Is there something else I need
> to do?
>
> Thanks
>
> -Original Message-
> From: Johan Compagner [mailto:[EMAIL PROTECTED]
> Sent: Monday, May 05, 2008 5:58 PM
> To: users@wicket.apache.org
> Subject: Re: forcing cookies to expire
>
> When is that clear cookie called?
> Can you follow that call a bit more, is it pushed to the
> httpservletresponse object?
>
> On 5/5/08, Andrew Broderick <[EMAIL PROTECTED]> wrote:
> > Hi,
> >
> > I am trying to manage cookies in Wicket. I can create them and read them
> no
> > problem, but forcing expiry by setting maxAge=0 does not seem to be
> working.
> > Here is the code:
> >
> > Set cookie:
> >
> >   public void setRememberMeCookie(String username)
> >   {
> > Cookie cookie = new Cookie(REMEMBER_ME_COOKIE, username);
> > cookie.setMaxAge(-1);
> > cookie.setPath("/");
> > getWebRequestCycle().getWebResponse().addCookie(cookie);
> >   }
> >
> > Clear cookie:
> >
> >   private void clearCookie(String name)
> >   {
> > Cookie cookie =
> > getWebRequestCycle().getWebRequest().getCookie(name);
> > cookie.setMaxAge(0);
> > getWebRequestCycle().getWebResponse().addCookie(cookie);
> >   }
> >
> > The code is definitely called. However, the cookie remains. What am I
> doing
> > wrong?
> >
> > Thanks
> >
> > ___
> >
> > The  information in this email or in any file attached
> > hereto is intended only for the personal and confiden-
> > tial  use  of  the individual or entity to which it is
> > addressed and may contain information that is  propri-
> > etary  and  confidential.  If you are not the intended
> > recipient of this message you are hereby notified that
> > any  review, dissemination, distribution or copying of
> > this message is strictly prohibited.  This  communica-
> > tion  is  for information purposes only and should not
> > be regarded as an offer to sell or as  a  solicitation
> > of an offer to buy any financial product. Email trans-
> > mission cannot be guaranteed to be  secure  or  error-
> > free. P6070214
> >
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


RE: forcing cookies to expire

2008-05-06 Thread Andrew Broderick
Hi,

clearCookie() is called in the constructor of a page called SignOut. The entire 
constructor is:

public SignOut()
{
clearCookie(Register.REMEMBER_ME_COOKIE);
getSession().invalidate();
}

As I mentioned the cookie is never cleared. Is there something else I need to 
do?

Thanks

-Original Message-
From: Johan Compagner [mailto:[EMAIL PROTECTED]
Sent: Monday, May 05, 2008 5:58 PM
To: users@wicket.apache.org
Subject: Re: forcing cookies to expire

When is that clear cookie called?
Can you follow that call a bit more, is it pushed to the
httpservletresponse object?

On 5/5/08, Andrew Broderick <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I am trying to manage cookies in Wicket. I can create them and read them no
> problem, but forcing expiry by setting maxAge=0 does not seem to be working.
> Here is the code:
>
> Set cookie:
>
>   public void setRememberMeCookie(String username)
>   {
> Cookie cookie = new Cookie(REMEMBER_ME_COOKIE, username);
> cookie.setMaxAge(-1);
> cookie.setPath("/");
> getWebRequestCycle().getWebResponse().addCookie(cookie);
>   }
>
> Clear cookie:
>
>   private void clearCookie(String name)
>   {
> Cookie cookie =
> getWebRequestCycle().getWebRequest().getCookie(name);
> cookie.setMaxAge(0);
> getWebRequestCycle().getWebResponse().addCookie(cookie);
>   }
>
> The code is definitely called. However, the cookie remains. What am I doing
> wrong?
>
> Thanks
>
> ___
>
> The  information in this email or in any file attached
> hereto is intended only for the personal and confiden-
> tial  use  of  the individual or entity to which it is
> addressed and may contain information that is  propri-
> etary  and  confidential.  If you are not the intended
> recipient of this message you are hereby notified that
> any  review, dissemination, distribution or copying of
> this message is strictly prohibited.  This  communica-
> tion  is  for information purposes only and should not
> be regarded as an offer to sell or as  a  solicitation
> of an offer to buy any financial product. Email trans-
> mission cannot be guaranteed to be  secure  or  error-
> free. P6070214
>

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: forcing cookies to expire

2008-05-05 Thread Johan Compagner
When is that clear cookie called?
Can you follow that call a bit more, is it pushed to the
httpservletresponse object?

On 5/5/08, Andrew Broderick <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I am trying to manage cookies in Wicket. I can create them and read them no
> problem, but forcing expiry by setting maxAge=0 does not seem to be working.
> Here is the code:
>
> Set cookie:
>
>   public void setRememberMeCookie(String username)
>   {
> Cookie cookie = new Cookie(REMEMBER_ME_COOKIE, username);
> cookie.setMaxAge(-1);
> cookie.setPath("/");
> getWebRequestCycle().getWebResponse().addCookie(cookie);
>   }
>
> Clear cookie:
>
>   private void clearCookie(String name)
>   {
> Cookie cookie =
> getWebRequestCycle().getWebRequest().getCookie(name);
> cookie.setMaxAge(0);
> getWebRequestCycle().getWebResponse().addCookie(cookie);
>   }
>
> The code is definitely called. However, the cookie remains. What am I doing
> wrong?
>
> Thanks
>
> ___
>
> The  information in this email or in any file attached
> hereto is intended only for the personal and confiden-
> tial  use  of  the individual or entity to which it is
> addressed and may contain information that is  propri-
> etary  and  confidential.  If you are not the intended
> recipient of this message you are hereby notified that
> any  review, dissemination, distribution or copying of
> this message is strictly prohibited.  This  communica-
> tion  is  for information purposes only and should not
> be regarded as an offer to sell or as  a  solicitation
> of an offer to buy any financial product. Email trans-
> mission cannot be guaranteed to be  secure  or  error-
> free. P6070214
>

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



forcing cookies to expire

2008-05-05 Thread Andrew Broderick
Hi,

I am trying to manage cookies in Wicket. I can create them and read them no 
problem, but forcing expiry by setting maxAge=0 does not seem to be working. 
Here is the code:

Set cookie:

  public void setRememberMeCookie(String username)
  {
Cookie cookie = new Cookie(REMEMBER_ME_COOKIE, username);
cookie.setMaxAge(-1);
cookie.setPath("/");
getWebRequestCycle().getWebResponse().addCookie(cookie);
  }

Clear cookie:

  private void clearCookie(String name)
  {
Cookie cookie = 
getWebRequestCycle().getWebRequest().getCookie(name);
cookie.setMaxAge(0);
getWebRequestCycle().getWebResponse().addCookie(cookie);
  }

The code is definitely called. However, the cookie remains. What am I doing 
wrong?

Thanks

___

The  information in this email or in any file attached
hereto is intended only for the personal and confiden-
tial  use  of  the individual or entity to which it is
addressed and may contain information that is  propri-
etary  and  confidential.  If you are not the intended
recipient of this message you are hereby notified that
any  review, dissemination, distribution or copying of
this message is strictly prohibited.  This  communica-
tion  is  for information purposes only and should not
be regarded as an offer to sell or as  a  solicitation
of an offer to buy any financial product. Email trans-
mission cannot be guaranteed to be  secure  or  error-
free. P6070214