How to invoke a Servlet (doGet) in a web application on startup?

Posted by Dan on Stack Overflow See other posts from Stack Overflow or by Dan
Published on 2010-06-07T21:31:18Z Indexed on 2010/06/07 22:02 UTC
Read the original article Hit count: 137

I need to invoke a Servlet on application startup since it contains some application initialization logic.

I know I can set load-on-startup configuration, but this will only invoke Servlet’s init method. I need to invoke a doGet method and pass some Url parameters to it. Servlet doGet method expects ServletRequest and ServletResponse objects.

Also, since this is clustered application, I need to know exactly what node I am accessing (since one option is just to open a socket and invoke a Servlet).

What is the best option to perform this?

© Stack Overflow or respective owner

Related posts about java

Related posts about web-applications