directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <>
Subject Re: Tomcat uses JNDI to load resources, including JSP pages
Date Mon, 05 Jan 2004 00:33:27 GMT
Quoting Phil Steitz <>:

> Noel J. Bergman wrote:
> > Guys,
> > 
> > See:
> >
> >
> > 
> > Craig provided a nice explanation of how tomcat loads resources. 
> Highlight:
> > 
> >   Basically, Tomcat models the static resources of a web application
> >   as a JNDI DirContext, with nested DirContext objects for nested
> >   "directories" in the WAR.  [Two] implementations are included --
> >   one for running webapps out of [a directory and one for running
> >   from a WAR.]  All the access details [are] hidden inside these
> >   implementations.
> > 
> > I did not realize, but am seriously pleased to know, that tomcat worked
> that
> > way.  This is really wonderful news.  Any data source for which we can
> write
> > a JNDI provider is capable of hosting web resources.  That could include:
> > 
> >   - a Subversion repository, via WebDAV
> >   - an LDAP database
> >   - an RDBMS
> >   - a CVS repository
> > 
> > Anyone getting excited about the possibilities, yet?
> Yes, this is very cool. This is also a big help to me in grokking Tomcat's 
> JNDI use cases.  I have been (slowly, sometimes with much puzzling) trying 
> to assemble an initial set of tests for the naming code, based on Tomcat's 
> uses. Thanks, Craig!
> I am still not clear on what is specific to Tomcat in terms of web 
> resource loading and what could be made generic (so that the contexts that 
> we could provide would be useful to other containers). Hopefully, this 
> will become clearer as I make my way through the code.

It's been a little while since I looked (I've been active on other things for
the last couple of years, and am primarily lurking on TOMCAT-DEV at the
moment), but here's a few things that might be considered Tomcat specific:

* Configuration of the initial contents of the JNDI context for the
  static resources is all hard coded -- there's no externally
  defined mechanism at the moment.

* Only the entry attributes that a servlet container cares about
  are exposed (create timestamp, size in bytes).

* The ability to recreate the contents of the context (used when
  a webapp is reloaded) is probably Tomcat-specific.

None of this is all that hard to deal with in a refactoring.

When looking at the code, you should also note that Tomcat also creates a
separate in-memory JNDI context for the environmental resources defined in the
web application deployment descriptor (<env-entry>, <resource-ref>, ...).  I
guess that counts as a third JNDI implementation, but the one that deals with
the things you are talking about starts from

> Phil
> > 
> > 	--- Noel
> > 


View raw message