File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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 REST with Spring (video course) this week in the Spring 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: 544
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: 63547

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

[Asking smart questions] [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: 544
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.

Don't get me started about those stupid light bulbs.
subject: How to force URL Rewriting
It's not a secret anymore!