• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ServletContext within ServletConfig

 
Vikrama Sanjeeva
Ranch Hand
Posts: 760
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

The ServletContext object is contained within the ServletConfig object, which the Web server provides the servlet when the servlet is initialized

It is composition.Is there any field within ServletConfig obj. in which ServletContext obj. is assinged by Web Container?
Bye.
Viki.
SCJP2
 
ersin eser
Ranch Hand
Posts: 1072
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
getServletConfig() of Servlet returns ServletConfig ,
getServletContext() of ServletConfig returns ServletContext
thus getServletConfig().getServletContext() gives you a ServletContext
 
Vikrama Sanjeeva
Ranch Hand
Posts: 760
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please read my question again.I am asking here again...
Is there any field within ServletConfig obj. in which ServletContext obj. is assinged by Web Container?
Bye.
Viki.
 
Madhav Lakkapragada
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ServletConfig is an Interface.
The class implementing may have such a field, I don't know. Try getting Tomcat source and looking up.....if you are interested.
regds.
- satya
 
Maulin Vasavada
Ranch Hand
Posts: 1873
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
as far as the API goes, it doesn't describe any such object. it should be servlet engine dependent.
regards
maulin
 
Madhav Lakkapragada
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
as far as the API goes, it doesn't describe any such object
Interfaces cannot have any "fields". The ONLY one's allowed are constants that are declared both static and final. Hence you connot have such a thing in the interface. ServletConfig is an interface.
Yes in all likely hood the implementing class may have such a field.
regds.
- satya
 
R K Singh
Ranch Hand
Posts: 5384
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think the class which implements ServletConfig (by Servlet Engine) must be having private member of type ServletContext which is returned by getServletContext().
CMIW
TIA
I have to download source for Tomcat.... feeling hungry ... going ... C U l8er.
[ February 27, 2002: Message edited by: Ravish Kumar ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic