When we are implementing session tracking using SERVLET API, container implicitly uses cookie mechanism to exchange the session id between the client and the server. If cookies are disabled in the client, session tracking gets failed. In such a case, web containers make use of URL rewriting mechanism to track sessions. In order for this mechanism to work, all URLs in the page should be encoded using the encodeURL() method of HttpServletResponse interface. This method appends a path string of the form sessionid=AB1234UKDM3421A09B to the input URL. Public String encodeURL(String url):- Encodes the specified URL by including the session ID in it, or, if encoding is not needed, returns the URL unchanged. The implementation of this method included the logic to determine whether the session ID needs to be encoded in the URL. For example, if the browser supports cookies, or session tracking is turned off, URL encoding is unnecessary. For robust session tracking, all URLs emitted by a Servlet should be run through this method.
