• 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 all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Liutauras Vilda
  • Paul Clapham
  • Bear Bibeault
  • Jeanne Boyarsky
  • Ron McLeod
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Carey Brown
  • salvin francis
  • Scott Selikoff
  • fred rosenberger

Chain Of Responsibilty question

Posts: 26
  • Mark post as helpful
  • send pies
  • 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
  • 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
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    Bookmark Topic Watch Topic
  • New Topic