RE: Servlet Filters
If that doesn't work, you could try using the HttpServletRequest.getRequestURI() method to spot requests for /test/* and forward these requests to the right servlet or JSP. /Manne -Original Message- From: Trond Nilsen [mailto:[EMAIL PROTECTED]] Sent: 28 February 2001 22:51 To: Orion-Interest Subject: RE: Servlet Filters > We want to use a servlet filter to intercept *all* requests that come into > the web server. Is this possible? It seems to work for all files when I > put the URL filter as "/" or "/*". But we're also looking to be notified > when a directory resource is requested. An example of this might be a url > that looks like so: "http://www.somecompany.com/test". Test is not a > virtual directory nor is it a directory under our site root. We forward > these directory requests to a JSP that then produces the appropriate output > for this directory on the fly. > > Has anyone tried this? Or is there another way to filter HTTP requests in > the Orion web server? Given that you seem to have worked out how to intercept /*, intercepting /test/* is a simple extension of that. Presumably you have something like this in your web.xml WhereStuffGoesByDefault /* So for /test/* you'd have TestServlet /test/* The problem is working out which order they're considered. I imagine it's probably the order they're specified, so you'd want the test one listed first in your web.xml. I'm assuming that by intercepting all requests you want everything (except test/*) to go to a particular servlet. If you just mean intercept and feed back whatever resource they asked for, then all you need is the second code snippet in your web.xml Trond.
RE: Servlet Filters
> We want to use a servlet filter to intercept *all* requests that come into > the web server. Is this possible? It seems to work for all files when I > put the URL filter as "/" or "/*". But we're also looking to be notified > when a directory resource is requested. An example of this might be a url > that looks like so: "http://www.somecompany.com/test". Test is not a > virtual directory nor is it a directory under our site root. We forward > these directory requests to a JSP that then produces the appropriate output > for this directory on the fly. > > Has anyone tried this? Or is there another way to filter HTTP requests in > the Orion web server? Given that you seem to have worked out how to intercept /*, intercepting /test/* is a simple extension of that. Presumably you have something like this in your web.xml WhereStuffGoesByDefault /* So for /test/* you'd have TestServlet /test/* The problem is working out which order they're considered. I imagine it's probably the order they're specified, so you'd want the test one listed first in your web.xml. I'm assuming that by intercepting all requests you want everything (except test/*) to go to a particular servlet. If you just mean intercept and feed back whatever resource they asked for, then all you need is the second code snippet in your web.xml Trond.
Re: Servlet Filters -> Apache Mod_Rewrite
> Has anyone thought of writing a Mod_Rewrite clone using Servlet Filters? > Using something like the Jakarta ORO regex package this should be quite > doable? > > Any reason that wouldn't work? (I've never actually used Mod_Rewrite, just > read about it). I've done something similar, but filters are not required. Simply create a servlet that sends appropriate redirects then use s to assign it to URL's. -Joe Walnes
Re: Servlet Filters -> Apache Mod_Rewrite
Mike Cannon-Brookes wrote: > > Guys, > > Has anyone thought of writing a Mod_Rewrite clone using Servlet Filters? > Using something like the Jakarta ORO regex package this should be quite > doable? > > Any reason that wouldn't work? (I've never actually used Mod_Rewrite, just > read about it). > > Mike Yes, we've thought of it. We created a "SuperServlet" that is set up as a filter and handles all requests, handing off the requests to the appropriate code based on some parsing, etc. We didn't clone mod_rewrite, we just did the pattern matching that we specifically needed. -- Joel Shellman Chief Software Architect http://www.ants.com/90589781