Hi all, a question re: url mapping and static resources

I have a fairly basic webapp/servlet which uses velocity 
for building dynamic pages either from content extracted
from xml data sources, or from static html pages which 
are wrapped in velocity templates. The webapp is served from 
tomcat (4.x). 

Basic out of the box setup for WEB-INF/web.xml was straight
forward just mapping everything for the particular url pattern 
to the servlet, as in:

    <servlet-mapping>
        <servlet-name>foo</servlet-name>
        <url-pattern>/foo/*</url-pattern>
    </servlet-mapping>


Content providers are now depositing static html with references
to local (as in within the servlet's context) resources (e.g.,
images, archives, pdf etc), and the original conf is no longer
sufficient. My attempts to map specific extensions to the default
servlet have not worked:

    <servlet-mapping>
      <servlet-name>default</servlet-name>
      <url-pattern>*.pdf</url-pattern>
    </servlet-mapping>

    <servlet-mapping>
      <servlet-name>default</servlet-name>
      <url-pattern>*.png</url-pattern>
    </servlet-mapping>

What I need to have is: a) for my servlet to service the html resources
both (pseudo)-static and dynamic, and b) for everything else to served
by the default servlet (or whatever it is within tomcat which serves
static resources, as in:

  /foo/bar/baz.html ==> foo servlet
  /foo/bar/images/baz.gif ==> tomcat
  /foo/bar/baz.pdf ==> tomcat

FAQ's and forums I have searched give pointers on how to map complete
paths to this or that servlet but I have not found anything which 
says how to map parts of paths to this and parts of paths to that.

Any help much appreciated.

Robbe Stewart
Contractor
2.C.64

Reply via email to