[thelist] tomcat config - regexp in url-pattern?

Hassan Schroeder hassan at webtuitive.com
Thu Oct 2 15:00:19 CDT 2003


Sam-I-Am wrote:

>              I used "my servlet" loosely - its not my code and while I 
> could ask the developer to work in something like this (I'm not a java 
> guy and not about to be this week) the servlet is intended to be fairly 
> generic.

OK, got it, but I should point out that RequestDispatchers can be
chained, so you could front-end the existing servlet (and all the
other non-servlet stuff) with a very simple "switch" servlet that
just looked at whether pathInfo exists. Might be worth discussing
with your Java developer.

 >       On another project I'm using reverse proxing in Apache to relay
> some requests to Tomcat, but handle all the other urls (that don't have 
> the /context prefix) itself. I think I can use RewriteRules to do the 
> same with the -P flag and maybe get the flexibility I need that way? I'd 
> be starting afresh with mod_rewrite, but that might be a better 
> investment of my time at this point.

Reverse proxy? So you're not using mod_jk/jk2? In that case, yeah,
mod_rewrite would probably work, but I've used it minimally, so I'll
let someone more experienced jump in here  :-)

> I'd need a regex or set of conditions to do:
> if the path does start with /context/, and ends with / or /?somesuch,
>   relay on to tomcat at localhost:8080/path
> if the path starts with /context/ and ends with /\w+\.shtml
> rewrite to /ssi/remainder-of-path
> ... and so on
>   otherwise ignore (leave unmolested) and let apache handle the request 

Good luck,
-- 
Hassan Schroeder ----------------------------- hassan at webtuitive.com
Webtuitive Design ===  (+1) 408-938-0567   === http://webtuitive.com

                           dream.  code.





More information about the thelist mailing list