I have a 3 scenarios to handle
1) Authenticate User
2) For Any Request After Login, User should have valid HttpSession Unique Id.
3) As some values in HttpSession has been modified for that specific user, then Audit Log entry to be made into database.
I think for
Scenario 1 – Servlet is helpful
Scenario 2 – Filter is Helpful
Scenario 3 – HttpSessionListner is helpful.
Also what will be the sequence of calling, if we define these 3 in web.xml and request is processed by web container ?
1) Servlets are dependent on the priority you given to it, If you give ‘load-on-startup’
as 1 then it is called immediately when your application starts, or if you not then it is
called normally when you made request for it.
2) Filter gets called at every server request.
3) HttpSessionListner is called when your session is created or destroyed.