I have an application where one servlet will respond to a request with a URL targeted to another servlet. Something like:
Client to Servlet 1: Can I get a new phone? Servlet 1: Sure; here's what you need to ask for (http://blah/phone/1234/) Client to Servlet 2: Can I get 1234? Servlet 2: Sure, here it is...
To do this it would be nice to either:
Both of these require some sort of introspection on the servlet configuration, preferably at init(). But the URL pattern part of it just isn't there -- I can get my servlet name from the ServletConfig passed into init(), but I can't take that name and get additional information from the ServletContext. Am I missing something?
(I know that I could just declare the URL as an initialization parameter to either servlet 1 or 2, but then I'm declaring it twice. I also know that I could pull that parameter out into a configuration file and do some pre-processing of web.xml before deployment, but down that path is madness.)