Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Reg Front Controller Pattern...

 
Shruthi Karthick
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Whether Front Controller pattern can be used for log incoming request like Intercepting Filter Pattern?
 
Khadija Lokhandwala
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No. These are two different patterns with different purposes.
Front Controller : a central controller for handling all the requests
Intercepting Filter : for a particular request to perform a function

So, if you want to log each incoming request, you could put a filter.

I hope I cleared your doubt
 
Vikas Parikh
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Difference between these two patterns are easily understandable by following example, given by Hanumant Deshmukh in SCWCD Stydy Kit.

Filter:

This is like a Security Guard, which checks each and every person wanting to enter the facility

Front Controller:

This is like a beautiful (Adjective is mine ) Receptionist, in the facility to give the required information and directs the person to necessary place
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't agree. Logging is usually more of a crosscutting concern. It's something you could add to any class without violation. You could add logging to a simple java bean setter method or in the middle of a DAO method. It's not a big deal.

I do agree that an Intercepting Filter is almost always a better place than a Front Controller for logging incoming requests, primarily because filters are so pluggable using the deployment descriptor. Additionally, if you had another filter that wrapped the request to alter its behavior, you could choose to place your logging filter first before the wrapping happens - you wouldn't have this option if your logging was in the Front Controller.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic