Iam when I submitting a request from a browser im setting a cookie in the response object using this code pResponse.setHeader(SET-COOKIE, token=randomvalue; HttpOnly; secure)
but when this request is submitted and in the target page when i try to get this cookie using the pRequest.getCookieParameter("token")
I am getting null
. In this case calling page and the target page is in different directory. If both calling page and target page in same directory can able to retrieve the cookie value properly. My code will be look as like below when I setting the cookie.
Cookie tokenCookie = new Cookie(SECURE_TOKEN, EMPTYSTRING);
tokenCookie.setPath("/");
tokenCookie.setSecure(true);
tokenCookie.setValue(randomString);
tokenCookie.setMaxAge(-1);
pResponse.setHeader(SET-COOKIE, token=randomvalue; HttpOnly; secure)