tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <cmcclana...@mytownnet.com>
Subject Re: cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/core Context.java
Date Fri, 15 Oct 1999 15:03:41 GMT
"Anil K. Vijendran" wrote:

> "Craig R. McClanahan" wrote:
>
> > > >
> > > > 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.
>
> I haven't verified this but wouldn't you get a linker error if for example there's a
> class file that contains a reference to org.apache.tomcat.core.Context.class and it is
> attempted to be loaded in a servlet container which does not have that class?
>

You'd get a NoClassDefFound or ClassNotFound exception, which you'd want to trap.

Craig



Mime
View raw message