I unable to create cookies in Safari browser with httpOnly flag.
See below piece of code
- RequestDispatcher rd = request.getRequestDispatcher("pages/welcome.jsp");
- Cookie currCookie = new Cookie("userInfo", "username: " + u + "password: " + p);
- currCookie.setDomain("anil.mlbextrabases.com");
- currCookie.setComment("creating cookie");
- currCookie.setPath(";Path=/;HttpOnly;");
- currCookie.setMaxAge(31536000);
- response.addCookie(currCookie);
- response.setHeader("Strict-Transport-Security", "max-age=7776000; includeSubdomains");
- rd.include(request, response);
The above code able to set cookies in all others browsers (Chrome, Firefox , IE).
If the remove httpOnly flag , then cookies are created succussfully safari as well . //currCookie.setPath(";Path=/;HttpOnly;");
I did a lot of R&D over developer communities. But it not helped.
Please suggests