users@glassfish.java.net

Re: Rewriting URLs to change servlets?

From: <glassfish_at_javadesktop.org>
Date: Mon, 06 Aug 2007 12:36:41 PDT

> In theory, this should work. However it doesn't (I
> get 404s), and I don't
> quite know why. My guess is that before the request
> ever gets to my filter,
> glassfish has already decided which servlet/file is
> going to receive it, and
> me rewriting the URL (by changing what the request's
> getRequestURI() returns)
> has no effect.

Yes, this is exactly what has happened. The container has already decided what to do before it invokes your filter. (That's why it knows to invoke your filter, in fact -- it's kind of a catch-22.)

The hot tip to get around this is to FORWARD to your new URL, and then it will work as expected.
[Message sent by forum member 'whartung' (whartung)]

http://forums.java.net/jive/thread.jspa?messageID=229691