Duane Morse wrote:
>
> Does the servlet specification say anything about how the
> servlet container should deal with static variables
> in the same class when used by different web applications?
>

 It depends on where the container finds the class.

 If the class is in your webapp's WEB-INF directories,
then it's loaded by that webapp's own personal
classloader. Classes loaded by different classloaders
are by definition different, so there is no sharing
of statics across webapps.

 If the class is outside your WEB-INF directories, then
things get fuzzier. The spec doesn't really require anything
more than "there ought to be a way to share container wide
utility classes somehow". The "somehow" is up to the
container.

 For a description of how Tomcat 4 does it, try:

   http://jakarta.apache.org/tomcat/tomcat-4.0-doc/class-loader-howto.html

 but keep in mind that much of that is Tomcat specific,
other containers may do things differently.

 The servlet spec has some discussion, it's available
at:

  http://java.sun.com/products/servlet/index.html

 The info is kind of scattered around. Do a search
for "loader" and you'll hit the high points.


--
Christopher St. John [EMAIL PROTECTED]
DistribuTopia http://www.distributopia.com

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to