My goal is reaching the same servlet servlet1 with all urls of the following pattern:
myserver.com/path1/*
where * can be anything like "x", "x/xx", "x/xx/x.cfg" etc.
In the end I only want to treat urls following the regex [0-9a-zA-Z]+.(cfg|xml|htm) but I am fine with doing so in the servlet. The servlet parses the original URL and dynamically builds the requested config files.
When I have the following mapping
<servlet-name>servlet1</servlet-name>
<url-pattern>/path1</url-pattern>
as expected the url myserver.com/path1 leads to servlet1.
When I use the following mapping which looks like the one that makes sense to me:
<servlet-name>servlet1</servlet-name>
<url-pattern>/path1/*</url-pattern>
I can still reach servlet 1 with the url myserver.com/path1/.
I can not reach the servlet with the url myserver.com/path1/path2, this url actually throws me back to the welcome-files entry.
Actually, anything with a second path throws me back to the welcome-files entry regardless of what patterns I enter. With second path I mean anything myserver.com/path1/* where * is longer than 0 characters.
The only alternatives I currently see is letting the welcome-files entry handle my requests (ugly) or using
.cfg .xml *.htm
which makes urls like myserver.com/XXX.cfg work (myserver.com/X/XXX.cfg doesn't work). This would be ugly as well and would interfere with future development of that webapp though.
How do I get the mapping to work the way I want it to?
/path1/*
should work like a charm – Andremoniy