Friday, October 07, 2005

What is URL Rewriting ?


Passing cookies back and forth is the simplest way to exchange session ID’s. The goal for the Client and the Container is to exchange session ID info. If the client won’t take cookies, you can use URL Rewriting as a backup. URL Rewriting takes the session ID that’s in the cookie and sticks it right onto the end of every URL that comes into this application.

We add the session ID to the end of all the URL’s in the HTML we send back in the response.

http://www.myserver.com/catalog/index.html;jsessionid=1234

URL Rewriting works ONLY if we tell the response to encode the URL. If we don’t explicitly encode the URL’s, and the client won’t accept cookies, you won’t get to use sessions.

If you do encode your URL’s the Container will first attempt to use cookies for Session Management, and fall back to URL Rewriting only if the cookie approach fails.

Response.encodeURL(“/resourceName”);

0 Comments:

Post a Comment

<< Home