luni, 13 aprilie 2015

[OmniFaces utilities (2.1/2.0)] Remove the cookie with given name and path from the HTTP response


[OmniFaces utilities] The removeResponseCookie() method remove the cookie with given name and path from the HTTP response. Note that the name and path must be exactly the same as it was when the cookie was created.

Method:
Usage:

Add a cookie with given name, value, path and maxage to the HTTP response.

import org.omnifaces.util.Faces;
...
// session cookie with explicit path
Faces.addResponseCookie("favorite_game", "Time Gap", "/mypath", -1);

Remove this cookie:

import org.omnifaces.util.Faces;
...
Faces.removeResponseCookie("favorite_game", "/mypath");

Niciun comentariu:

Trimiteți un comentariu