Servlet Initialization Listener

488 Views Asked by At

I am trying to identify when a servlet is initilazed (not the init() method called), when container try to load an individual servlet ? Or, any mechanism which keeps track of servlet initialized / destroyed / pending to load.

I am aware of the ServletContextListner, which invoked on application start & shutdown. But, I am looking for kind of listener, which probably trigger on individual servlet load / destroy event.

So, scenario would be like : /Servlet1 /Servlet2 An listener which trigger on servlet1 load and then for Servlet2.

1

There are 1 best solutions below

1
Avinash Reddy On

I guess this is the listener you are looking for .You want to know each time a request comes in, so that you can log it. javax.servlet.ServletRequestListener . Following are the methods requestInitialized requestDestroyed