This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
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: 12761
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: 18541

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?
Don't get me started about those stupid light bulbs.
subject: Url rewriting
Similar Threads
Problem using JSTL c:redirect.
servlet initializatoin parameter to get relative path and file name
Session management - cookies / URL rewriting
Error compiling a simple servlet !!.... any ideas??
Streaming Video Through a Servlet (.wmp)