This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Doubts in Web Container concept Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Doubts in Web Container concept" Watch "Doubts in Web Container concept" New topic

Doubts in Web Container concept

kalle suresh
Ranch Hand

Joined: Nov 20, 2007
Posts: 48
I have one quick question on Container concept. On page 42 (HeadFirst Servlets & JSP book), talking about containers it was written like, once the request comes from the client container creates a HttpServletRequest and HttpServletResponse objects and those acts as a reference for the clients request and response. After that container creates a thread for that servlet and passes these request and response objects to the thread and calls the service method. Here i'm not able to understand who will call the threads start method and what will be the code in the created thread's run() method .

Code example for that thread class will be very helpful.
carina caoor
Ranch Hand

Joined: Jun 23, 2007
Posts: 300

Container calls the thread start method.
kalle suresh
Ranch Hand

Joined: Nov 20, 2007
Posts: 48
What could be the code in created thread's run it is interlinked with service() method
Marc Peabody
pie sneak

Joined: Feb 05, 2003
Posts: 4727

There is a very recent similar topic here:

The most important thing is that you don't have to worry about how it's done. That's the beauty of having the container - some of the work is already done for you and you don't have to care how it works internally. You only need to know how it works on the surface and how to interact with it.

A good workman is known by his tools.
I agree. Here's the link:
subject: Doubts in Web Container concept
Similar Threads
Using interface reference variable without instantiation
Request attributes within a servlet
Multithreading in servlet
Clarification required on Request and Response object being availabe for Garbage Collection
How does servlet stay active ?