aspose file tools*
The moose likes Servlets and the fly likes who calls service method ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "who calls service method ?" Watch "who calls service method ?" New topic
Author

who calls service method ?

Jigar Naik
Ranch Hand

Joined: Dec 12, 2006
Posts: 751
hi

i have got bunch of questions about servlet and life cycle.

Who calls service method & which class implements the service method ?


and if i deploy one web application today and tomorrow i undeploy it. in 1 day if i get 100 request.

how many times init() will be called ?
how many times service() method will be called ?
and how many times destroy() will be called ?

Thanks & Regards,


Jigar Naik


Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

A good place to start would be the servlet spec.
The section on the servlet life cycle is clear and well written.
You can find a link to this document in my signature.

Anyway.
The container calls the service method whenever a request comes in.
Init and destry will most likely be called once. (containers are free to take servlets out of commission to save resources). Each time it is taken out of service, the destroy method is called. Each time it it put into service, the init method will be called.
[ March 26, 2008: Message edited by: Ben Souther ]

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Jigar Naik
Ranch Hand

Joined: Dec 12, 2006
Posts: 751
When i was posting the question i was knowing your answer.. "Servlet Spec"

Thanks... Will refer the servlet spec for "who calls service method "
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Originally posted by Ben Souther:
The container calls the service method whenever a request comes in.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: who calls service method ?
 
Similar Threads
how many times is _jspService called?
Servlet's constructor
How that I call in java a service in the NT?
finalize()
Which the method of call of a service in the NT?