Delete cookie

Splash Forums PrettyFaces Users Delete cookie

This topic contains 3 replies, has 2 voices, and was last updated by  walluz 1 month, 1 week ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #27701

    walluz
    Participant

    This is situation, I have two mapped patterns

    .addRule(Join.path("/browse").to("/browse.xhtml"))
    

    and

    .addRule(Join.path("/browse/g/{gender}").to("/browse.xhtml"))
    

    , and I want to delete cookies when the user’s logout in the first one patterns this works fine but in the second one don’t.

    This is my code for delete the cookies

    Cookie cookie = new Cookie(name, value);
    cookie.setMaxAge(age);
    ((HttpServletResponse) (FacesContext.getCurrentInstance().getExternalContext().getResponse())).addCookie();
    
    #27703

    Well, you are calling .addCookie(). I’m pretty that this method won’t delete cookies. 😉

    #27704

    walluz
    Participant

    Actually I’m updating the age of the cookie to 0 seconds which removes it from the browser. The problem is that when I use the second pattern this does not work

    #27705

    walluz
    Participant

    I solved the problem just setting cookies path to “/”, for some reason I only need to do this if I’m using prettyfaces.

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.

Comments are closed.