Win a copy of GANs in ActionE this week in the AI forum
or WebAssembly in Action in the JavaScript forum!
  • 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 ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
  • Knute Snortum
Sheriffs:
  • Liutauras Vilda
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Joe Ess
  • salvin francis
  • fred rosenberger

Intercepting filter pattern vs Front Controller

 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I had a doubt on when to use Intercepting filter pattern and Front Controller pattern

This is what my uderstanding correct me if i'm wrong anywhere,

Intercepting filter pattern:

If the filter does not need to manipulate the data coming from the client and if there is no need carry state b/w the filters, then we can go for this pattern.

Front Controller Pattern:

Both these patterns are almost same but this will be used when the state need to be carried to the target like after manipulating the data received from the client request or when we need to send some additional data to the destination url once request is received from the client.

Please help me in understanding these two patterns like when to use which if i'm wrong.


Thanks in Advance


 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I think you are wrong. These two patterns are not almost the same. There are quite big differences between them, and not necessaryly those listed by you :
- Intercepting Filter allows defining loosely coupled handlers, which could be included during deployment process without changing the code (web.xml) . Also the order of filters execution could be changed in deployment descriptor. Front Controler is missing such features.
- Intercepting filter is mainly used for modifying request and response. The role of Front Controler is rather determining processing based on the request, without changing it.

My statements above could not be precise enough, I could advise you checking any of the book :
Core J2EE patterns: Deepak Alur, John Crupi, Dan Malks or Mikalai Zaikin notes or JEE study guide Cade/Roberts
Each of them contains clear definitions of each of these two patterns, emphasising the differences between them.

If you want to beter understand these patterns, I could also advise you source code analysis. "Core J2EE patterns" contains such examples. IMO it is the best way to understand the patterns. You can even create simple test servlet with some filters to make your own experiments. Its is definitely better way for learning, than reading boring lists of features of each pattern. Of course such lists are good, but only on the later stage of your preparations, when you understand the basic concepts.

I hope, I answered your question,

Regards,

Pawel Piwowar
 
Nandu itha
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Vey much Pawel for the good explanation
 
Ranch Hand
Posts: 256
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Pawel,
Very Good Informations.Thanks alot.
Cheers!
Prathap.
 
Ranch Hand
Posts: 63
Mac OS X jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nandu, before spending your money, you should take a look here:

Core J2EE Patterns from Sun website.
 
What's gotten into you? Could it be this tiny ad?
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!