my dog learned polymorphism*
The moose likes Servlets and the fly likes How Web container handle Request and response 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 » Java » Servlets
Bookmark "How Web container handle Request and response" Watch "How Web container handle Request and response" New topic
Author

How Web container handle Request and response

bikasit babu
Greenhorn

Joined: Mar 29, 2012
Posts: 28
if i am wrong at any of the point just make me correct.as i am new to this servlet section.
what i know about servlet up to this point is the web container while get /sees a request from the client .It creates two objects HTTP request Object(1) and HTTP response Object(2).
Then it creates a thread to the servlet and pass the request object .According to the URL it sees the GET method or POST method then call from service method.
After the Request has been handled the response stored in response Object . the container created thread dies . the response stored in response Object send back to the clients.by making it as HTTP response Object.


I don't know what i understood is correct or not if correct a question arise is when it send the HTTP request and when it send simple request. same about response.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60800
    
  65

According to the URL it sees the GET method or POST method then call from service method.

The URL does not specify the HTTP method. It is specified in the request header.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Devaka Cooray
ExamLab Creator
Saloon Keeper

Joined: Jul 29, 2008
Posts: 3019
    
  35

bikasit babu wrote:Then it creates a thread to the servlet and............ the container created thread dies .

Not always. Creating threads is a process-intensive task and it would exhaust the container if it attempts to create thousands of concurrent threads for handling thousands of simultaneous requests. Most of the containers avoid this problem by reusing the threads in thread pools, so a thread that has served a request may remain active for servicing another thread.


Author of ExamLab ExamLab - a free SCJP / OCPJP exam simulator
What would SCJP exam questions look like? -- Home -- Twitter -- How to Ask a Question
G krishna kumar
Greenhorn

Joined: Oct 10, 2012
Posts: 14
Bear Bibeault wrote:
According to the URL it sees the GET method or POST method then call from service method.

The URL does not specify the HTTP method. It is specified in the request header.


it should be from initial request line, from which it get the method information.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How Web container handle Request and response
 
Similar Threads
Chapter 2 (HFSJ) notes , may be useful for anyone
Servlet flow
How container Handle request
MVC Architecture.
MVC Architecture