I know that java gives us the ability to manipulate cookies, but there goes the question.
Is it possible to get cookies from the web browser? if yes, from which method?
I know that java gives us the ability to manipulate cookies, but there goes the question.
Is it possible to get cookies from the web browser? if yes, from which method?
See if the method below helps you:
Cookie[] cookies = request.getCookies();
if (cookies != null) {
for (int i = 0; i < cookies.length; i++) {
Cookie c = cookies[i];
System.out.println("Nome: " + c.getName());
System.out.println("Valor: " + c.getValue());
}
}
Remembering that to get request
through JSF, just do this:
FacesContext facesContext = FacesContext.getCurrentInstance();
HttpServletRequest request = (HttpServletRequest) facesContext.getExternalContext().getRequest();