sâmbătă, 11 aprilie 2015

[OmniFaces utilities (2.0)] Collect by name the value of the HTTP request cookie


[OmniFaces utilities] The getRequestCookie() method returns the value of the HTTP request cookie associated with the given name. The value is implicitly URL-decoded with a charset of UTF-8.

Method:
Usage:

You can use this method to collect the value of any cookie, but for a quick test you can try to obtain the user session ID, which is stored by JSF (by default) under a cookie named, JSESSIONID:

// e.g. FzfUURPXjp6L_Sx6nhsqf3Zg.leonard-pc
String sessionId = Faces.getRequestCookie("JSESSIONID");

Niciun comentariu:

Trimiteți un comentariu