798185 wrote:So what request/response are you processing at container startup? Using a filter for this is abuse.
Thanks for your reply.
Filter is for pre processing Request/post process response and
All these objects were created to solve different problems. Many people abuse them, don't be one of them..All these type of objects and created and life cycle methods are invoked by container during application deployment. But the thing is that both filter and servelt has init method and init method is invoked only once by container ,this can be used for init purpose . So for a web application having a Filter then Is it a right choice to use that filter for initialization?.
Yes, that is what it was created for.Do we need to go for a ServletContextListener to do this Task?
I have seen examples of using Servelt and ServletContextListener for initialization but not filter. Is there anything wrong in using filter for the same?Yes. It's the wrong tool for the job.
Servelt without any mapping and load-on-startup can be used for initialization
And what request is such a servlet serving? Again more abuse.