jQuery in Action, 3rd edition
The moose likes Servlets and the fly likes How to force URL Rewriting Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "How to force URL Rewriting" Watch "How to force URL Rewriting" New topic

How to force URL Rewriting

amit punekar
Ranch Hand

Joined: May 14, 2004
Posts: 540
I have a scenario wherein I want to force the encoding of a URL so that response.encodeURL() appends the sessionid to it.
At the moment this API is not appending the sessionid which I guess is because session is being tracked by cookies , in which case the API method does not necessarily appends the sessionid.
Is there anyway I can force this to happen?


Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63052

That's not "encoding", that's "rewriting". I suggest you change your subject accordingly.

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Abhishek Asthana
Ranch Hand

Joined: Sep 08, 2004
Posts: 146
You are right. response.encodeURL() will append sessionID only if cookies are disabled.
But why do you need to append the sessionID to URL, when you can always pick it up from the session.

amit punekar
Ranch Hand

Joined: May 14, 2004
Posts: 540
Thanks for pointing out the mistake.

I want to force the URL rewriting even if cookies are enabled. There is one scenario we have where sessionid as part of URL is needed.

subject: How to force URL Rewriting
It's not a secret anymore!