• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Chain Of Responsibilty question

 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is it a good practice to have a filter which does a remote call and based on the result, redirect the request or massage the request with more data etc.

I am feeling not. But it is a mere gut feel opinion. So, I want the forum to express their opinion.
 
Ranch Hand
Posts: 372
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's not a good idea to forward to a specific servlet or JSP from a filter. If you do that, you increase the coupling between the filter and the specific servlet / JSP. Filters are meant to be generic and in a good design, they should have no idea about which filter or servlet comes next in the chain. Hence, good design should preserve this loose coupling. Filters are meant to customize the request and response and should normally not take important decisions as redirecting to a specific servlet / JSP . If you introduce such dependencies, you'll have to end up changing code if the flow changes later. The main purpose of filters is to avoid such code changes and handle them declaratively in the DD

Let me know what you if you have a second opinion
 
reply
    Bookmark Topic Watch Topic
  • New Topic