Cookie not dded

UI Components for JSF
Post Reply
shuster.boris
Posts: 5
Joined: 09 Aug 2017, 08:22

19 Oct 2017, 08:45

Hello, all!
I'm trying to add cookie in primefaces, using CookieHelper, listed here https://stackoverflow.com/questions/209 ... kie-in-jsf
FacesContext facesContext = FacesContext.getCurrentInstance();
HttpServletRequest request = (HttpServletRequest) facesContext.getExternalContext().getRequest();
cookie = new Cookie(name, value);
cookie.setPath(request.getContextPath());
cookie.setMaxAge(7*24*60*60);
HttpServletResponse response = (HttpServletResponse) facesContext.getExternalContext().getResponse();
response.addCookie(cookie);

Immediatelly, I'm trying to get cookie
FacesContext facesContext = FacesContext.getCurrentInstance();
HttpServletRequest request = (HttpServletRequest) facesContext.getExternalContext().getRequest();

request.getCookies() does not contain cookie that added.

tandraschko
PrimeFaces Core Developer
Posts: 3979
Joined: 03 Dec 2010, 14:11
Location: Bavaria, DE
Contact:

19 Oct 2017, 09:12

Not related to PrimeFaces, try stackoverflow.
Thomas Andraschko

PrimeFaces | PrimeFaces Extensions

Apache Member | OpenWebBeans, DeltaSpike, MyFaces, BVal, TomEE

Sponsor me: https://github.com/sponsors/tandraschko
Blog: http://tandraschko.blogspot.de/
Twitter: https://twitter.com/TAndraschko

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 36 guests