File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes Url rewriting Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Url rewriting " Watch "Url rewriting " New topic

Url rewriting

Pawan Arora
Ranch Hand

Joined: Sep 14, 2008
Posts: 105

I'm trying to encode URL to make Url rewriting possible. I've already disable cookies, but when I try to call servlet in subsequent request, I'm getting "New user" as a respone every time.

Here's the servlet code:

The Url pattern, which I've written for servlet name is / in DD.
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 13024
Where is that encoded URL supposed to be used?

The browser has to create a request using the encoded URL somehow.

Pawan Arora
Ranch Hand

Joined: Sep 14, 2008
Posts: 105
Do you mean I'm not creating next request with the same URL which has just encoded. So what's response.encodeURL("/") is doing here?
David Newton

Joined: Sep 29, 2008
Posts: 12617

It's encoding the URL and returning a String that you ignore.
Paul Clapham

Joined: Oct 14, 2005
Posts: 19847

I'm not sure why you would need to worry about cookies or other forms of session preservation when you are forwarding a request. Can you explain why you think you do?
I agree. Here's the link:
subject: Url rewriting
It's not a secret anymore!