tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Antony Riley <>
Subject pure java mod_rewrite using javax.servlet.Filter
Date Fri, 10 Feb 2006 13:32:50 GMT
Hiya all,

I'm looking at writing a Filter class which does request rewriting similar
to mod_rewrite in a apache for Tomcat (preferably written so that it will
work with any servlets 2.4 compliant server).

I'm having a little trouble with regards how filters actually work.

The following all happen inside filters (tomcat 5.5, latest stable release):

1) Wrapping the HttpServletRequest with one which modifies
request.getRequestURI(), request.getPathInfo() request.getServletPath() does
not seem to work, as at this point tomcat seems to have already decided what
server will proces the request.

2) using request.getRequestDispatcher(<path>).forward(request,response)
seems to work, however, this does not cause the Filter to be reapplied as I
would have expected if called at this stage in the request parsing process.

3) When declaring a filter in a web.xml for an application with a
url-mapping of /* seems to break hideously if there is also a default
servlet also declared in the web.xml (the application specific web.xml, not
the server web.xml) [I can and will probably will have to provide further
info on this] seems to break rather horribly causing tomcat to server up
unprocessed jsp pages, and fail to do directory indexes, even though without
the filter mapping it works correctly.

-Antony Riley

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message