In my Java web application I have to set the JSESSIONID cookie to secure.
With Servlet 3.0 it's easily done in web.xml. My Problem is, I have to stick with Servlet 2.5.
I already tried to edit the created cookie with following code:
for (int i = 0; i < cookies.length; i++) {
if (cookies[i].getName().equals("JSESSIONID")) {
cookies[i].setSecure(true);
response.addCookie(cookies[i]);
}
}
but the only result I get back is a new cookie called JSESSIONID which is secured and the old JSESSIONID cookie stays unchanged.
Is there another way to edit the generated JSESSIONID cookie secure flag to true or is it impossible?
Thanks in advance for your help.