I’m reading a book on Servlets to review and it states that it will automatically decide when to append the session ID. I have read conflicting statements across the web. To what extent will it append the session ID to URLs automatically when cookies are blocked, and will this include the use of sendRedirect(). I’m referring to the most recent version. I have checked The JAVA Docs at Oracle.com but I’m not sure if they have been updated recently enough.
Thanks 🙂
No , the container does not have intelligence to detect the links in you template text or string which you write to the output stream.
For Ex, take this sample code:
In the above code, you have to do
HttpServletResponse.encodeURL("/submit.jsp")to have session id in the post action url.Similarly, the API Documentation for
HttpServletResponse.encodeRedirectURL()says thatReferences: