I have a WEB Application deployed in Tomcat. I would like to intercept all the incoming requests - get or post and perform some task. I want to intercept calls from servlet, from JSP pages etc. So I created one web.xml file which looks like this one -
<servlet>
<description></description>
<display-name>Transformer</display-name>
<servlet-name>Transformer</servlet-name>
<servlet-class>com.test.Transformer</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Transformer</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
As we can see, any request will come to this controller servlet called Transformer. Now this servlet usually tries to transform one request from A to B. The problem I am facing is - I am getting into a loop I just want to transform request for url /test.jsp to /abc/test.jsp but the second request /abc/test.jsp is also hitting the Transformer servlet and as a result it is not working as intended. I think I can use Filter but I have too many servlets and JSP pages in the application to put filter everywhere.