Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
The moose likes Servlets and the fly likes Servlet and Requests 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 "Servlet and Requests" Watch "Servlet and Requests" New topic

Servlet and Requests

Dilip kumar
Ranch Hand

Joined: Oct 16, 2000
Posts: 360
Hi All -

If I understood correctly whenever a new request (from browser) comes to a servlet it will handle that request in a new thread. And there will be only one instance of the servlet. How does a servlet differentiates 2 requests coming from same PC ?

William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 12761
How does a servlet differentiates 2 requests coming from same PC ?

Each request will be handled in its own Thread. If they are both coming from the same browser, they will (probably) have the same session. It is up to the programmer to handle any logic problems that might arise.
Multiple requests from the same browser are quite common - for example with servlet created images.
It is sorta covered in the JavaRanch Style Guide.
subject: Servlet and Requests
Similar Threads
changing http get request to post request
Servlet Container
New Request
Servlet instances
when init() method is called ?