I would like the page generic.xhtml to be served in response to requests for specific1.xhtml, specific2.xhtml, etc...
Is there some way to set up web.xml so that several requests map to a single file without doing a redirect? The specific.xhtml name should always be displayed to the user.
The specific names do not match a particular pattern, such as starting with the word specific. I have a list of specific names that are all implemented with one page.
This is equivalent to having generic.xhtml?name=specific1 except that the name parameter is the file name in the request.
If this cannot be handled through web.xml or some other configuration file, what is another approach?
Pages are served by Tomcat 7.
I think you should use Tuckey's UrlRewriteFilter. It should be pretty easy for you to come up with rules to achieve what you want. Suppose users access your page at www.yourserver.com/context/subContext/specificX.xhtml
, I think the following rule should achieve your goal (you need to test though :P):
<urlrewrite >
<rule>
<name>Specific to Generic forward</name>
<condition next="or" type="path-info">/subContext/specific1.xhtml</condition>
<condition next="or" type="path-info">/subContext/specific2.xhtml</condition>
<from>^(.*)$</from>
<to type="forward">/generic.xhtml</to>
</rule>
</urlrewrite>