On 8/7/09 18:00, Ivo Silva wrote:
Thanks for your reply, André!

I believe my situation is a bit more complex than a "simple" URL Rewrite.

Short explanation:
My aim is to create a RequestWrapper with a custom Session so that the
target page has access to some specific variables that cannot be store
in the regular session due to iframe instatiaton...

Nevertheless using URL Rewrite doesn't solve my problem (maybe if I
use it after may own filter it could be helpful but not for my
specific problem).
>
My problem is that my RequestWrapper (with my custom Session) is not
getting past the forward declaration. The Request Dispatcher forward
seems to use the original request instead of my wrapper when doing a
forward.

Filters are not applied during the RequestDispatcher.forward() operation.

You would need to wrap any unwrapped requests before passing a modified request to the forward method.

p

If the target page doesn't have forward all works fine.

So, don't mind about the URL Rewrite part, I just want to know if it's
possible to create a request wrapper and pass it on to a second page
(with a forward on the first page). Currently I get an infinite loop.

Thanks again!

On Wed, Jul 8, 2009 at 4:43 PM, André Warnier<a...@ice-sa.com>  wrote:
Ivo Silva wrote:
Hello, there!

I'm trying to implement a filter that takes a given request URL (that
contains a dummy folder) like so:

http://localhost/context/dummy_folder/page1.jsp

This filter takes the dummy_folder part from the URL (just like a URL
Rewrite), creates a custom RequestWrapper (HttpServletRequestWrapper)
with the correct paths (URI, URL, Servlet Path...) and passes it to
the filter chain.

By "correct path" I mean: http://localhost/context/page1.jsp

Every thing works great except when the target page (page1.jsp) does a
forward request:

RequestDispatcher rd = request.getRequestDispatcher("page2.jsp");
rd.forward(request, response);

This leads the requests to an infinite loop that keeps coming back to
page1.jsp.

I don't know if this is the correct approach (using an
HttpServletRequestWrapper to override the original request values).
The request forwarding uses the original request instead of my wrapper.

Any directions would be appreciated.

Why redo what has been done before ?
Check : http://www.tuckey.org/urlrewrite/


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to