Environment: Struts 1.1. Tomcat 6, Eclipse 3.6
Business Objective: Invoke an application(e.g. App B) from within an existing application (e.g. App A) based on certain criteria.
Tech Objective: Use Servlet Filter to catch a request from App A if its has a specific URL pattern and create a new request to App B.
Tech Design 1. I have defined a filter in my web.xml which looks for a specific URL pattern.
2. From my action class execute method I do a ActionMapping.findForward to a string expecting that web.xml entry for filter will match and filter class get executed
Issue The control rather goes to the struts-config.xml and there by totally bypassing the web.xml
Questions 1. What's the best way to achieve what I'm intending to do? if not then how can this be achieved?
You can't bypass giving "control" to your web.xml, your web.xml should be where you specified your servlet that runs your struts app. Are you sure you have the filter configured correctly? Posting your web.xml and the URL that the server is processing might help. Also, posting the code for your filter might help as well. Once you send your request to the other app, are you continuing with the filter chain? If so then it will probably still run the initial app.
Joined: Mar 15, 2011
So I resolved the issue. I was trying to solve the problem incorrectly.
what I wanted to achieve was to add a filter to existing application w/o making any drastic change to the existing code.
So the way I have structured the code is that my filter looks for a specific action and then starts the invocation of another application.
If anyone wants to refer to the code let me know I'll be happy to post a sample app.