I'm trying to set up a servlet so that any requests for /foo/*
will go to my Foo
servlet, except for requests in the form of /foo/bar/*
, which go to the Bar
one. However, I want /foo/bar
to go to the Foo
servlet, not the Bar
one. Is there a way to do this with just url-patterns in web.xml?
My mappings:
<servlet-mapping>
<servlet-name>Bar</servlet-name>
<url-pattern>/foo/bar/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Foo</servlet-name>
<url-pattern>/foo/*</url-pattern>
</servlet-mapping>
I've tried removing the asterisks and trying a few other patterns, but the only way I can see to do this is to have a specific mapping for /foo/bar
, though it seems like there should be a better way.