Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How does the container set the context/config objects?

 
Ralf Allar
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I'm wondering how the container sets the ServletContext when there's no setter method inside the ServletContext class.

: )
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The ServletContext object that's passed to the application (the one that you can access) is usually just a facade to a another object that only the container can access.

For instance, if you drop the following line into a JSP and run it under Tomcat, you will see that the context object made available to you is an instance of org.apache.catalina.core.ApplicationContextFacade


This is the same with all the other object that the container exposes to the applications (request, response, session, etc...).

The real classes behind the facade have, in addition to the methods defined in the servlet spec, any methods and properties needed by the container for setup and housekeeping.
[ February 09, 2008: Message edited by: Ben Souther ]
 
Ralf Allar
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ah, a facade... that makes sense.

Thank you!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic