Basically I want one servlet to handle all incoming request regardless of the path. I'm on shared hosting environment with access to configure my own web.xml file.
I have the following configured in web.xml, but it doesn't work on Tomcat 5:
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<display-name>Redirect</display-name>
<servlet>
<display-name>Redirect</display-name>
<servlet-name>Redirect</servlet-name>
<servlet-class>com.Redirect</servlet-class>
<init-param>
<param-name>host</param-name>
<param-value>www.myredirectdomain.com</param-value>
</init-param>
<init-param>
<param-name>redirect-type</param-name>
<param-value>301</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>Redirect</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
</web-app>
The above worked for anything starting with a directory in the path such as:
www.mydomain.com/anypath1/anypath2...
www.mydomain.com/anypath1
However, did not work for:
www.mydomain.com/ or
www.mydomain.com
I also tried the following servlet mapping:
<servlet-mapping>
<servlet-name>Redirect</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
With the same result. Neither worked... Anyone have any suggestions?