tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Hans Bergsten <h...@gefionsoftware.com>
Subject Re: cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/core Context.java
Date Fri, 15 Oct 1999 02:03:02 GMT
"Craig R. McClanahan" wrote:
> 
> "Anil K. Vijendran" wrote:
> 
> > Ok. Let me understand this better. We're trying to
> >
> >   1. change the name from servlet.classpath to org.apache.jasper.classpath,
> >   2. it would show in getAttributeNames()
> >   3. it wouldn't be modified in setAttribute() -- what is the right thing to
> >      do throw an exception? i don't like it. ignore it silently?
> >
> 
> I would like to suggest an alternative approach to this (and other analogous
> situations that come up in the future).  It's based on a design philosophy I
> feel pretty strongly about:  if you are going to pass around private
> implementation details, do not use public interface mechanisms.
> 
> You can avoid the whole issue of using context attributes at all if you
> modified the JSP engine code to do something like this:
> 
>     String classpath = null;
>     ServletContext context = getServletContext();
>     if (context instanceof org.apache.tomcat.core.Context) {
>         classpath =
>           ((org.apache.tomcat.core.Context) context).getClassPath();
>     } else {
>         classpath = ...;    // Initialized some other way
>     }
> 
> With this approach, there are no implementation-specific context attributes to
> worry about, so there is no reason to hard code mangling into getAttribute()
> and getAttributeNames(), and the intent is perfectly clear.

But this is a slightly different situation. The intention with all of this
was to make Jasper portable between servlet containers. The context attributes
are used to let the container inform Jasper about the classpath and class loader
that should be used. And any servlet container should be able to do this, not
just Tomcat.

Hans
-- 
Hans Bergsten		hans@gefionsoftware.com
Gefion Software		http://www.gefionsoftware.com

Mime
View raw message