• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Servlet Lifecycle Doubt?

 
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ranchers,

Say for example when we don't have a servlet initialized during container startup and when we request for a servlet, the container creates a request and response object. I want to know which one is created first, the servlet instance or the request and response instance?? Can anyone comment on this?
 
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The container instantiates a servlet either on startup(if specified) or on first request. So, I think it creates the request, response objects first and then the servlet instance if the servlet if already not loaded.

Am I right, ranchers?

Thanks and regards,
Saurabh
 
Joe San
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Anyone to support Saurabh?? Any convincing answers for me???
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think a more interesting question to ask would be: does it matter whether request/response or servlet are initialized first?
 
Joe San
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So does it really matter ulf?
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, you are the one preparing for the SCWCD (I assume)

Does it matter? If so, why? If not, why not?
 
Joe San
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Bemused. I just wanted to know this out of curiosity...which instance is created first...the request/response or the servlet instance?
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, look. Tomcat is open source. So you could get the source code of Tomcat and answer this question for yourself in the Tomcat context. That's not to say that Websphere or JBoss or any of the other servers do the same thing, though. I think we are all bemused why you care about this question.

My usual question is "What would you do differently based on the answer to this question?" but I try to avoid posting that in the certification forums, where it doesn't apply. However in this case I don't think the question is going to be asked on any certification exam, so perhaps it could be asked.
 
Joe San
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Paul, I know that this is a silly or rather irrelevant question, but I just wanted to know out of curiosity. Anyways thanks to all the ranchers who participated in this debate. Thanks again!
 
reply
    Bookmark Topic Watch Topic
  • New Topic