• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

Concepts | Using servlet filter within a struts application

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?

Thanks
 
Ranch Hand
Posts: 349
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
jazz pal
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
Thanks
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Jazz,
Could you please post the sample app?

--
Thanks
SuryaPavan
 
Something must be done about this. Let's start by reading this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic