[thelist] tomcat config - regexp in url-pattern?
Sam-I-Am
sam at sam-i-am.com
Thu Oct 2 13:48:01 CDT 2003
> Sam-I-Am wrote:
>
>> I have a <servlet-mapping> block, and want to map my servlet to handle
>> directory indexes only e.g.
<snip>
>
> Yeah, the Specification of Mappings (Servlet 2.3 section 11.2) is
> pretty constrained. I think your only option is to have the primary
> servlet take everything (/dir/*) and then use a RequestDispatcher
> to pass on the request to the other servlet(s) based on whatever's
> returned by request.getPathInfo().
thanks Hassan,
I knew that should be specified somewhere, but couldn't find it for the
life of me. 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. 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.
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
(I can alias /context to the correct directory)
Any pointers to achieve the above?
Meanwhile I'm going through
http://httpd.apache.org/docs/mod/mod_rewrite.html
and
http://www.engelschall.com/pw/apache/rewriteguide/
thanks, Sam
More information about the thelist
mailing list