tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <Craig.McClana...@eng.sun.com>
Subject [Fwd: getContextPath reflection tricks are broken]
Date Thu, 15 Jun 2000 20:45:00 GMT
Not sure this actually got sent ...

"Craig R. McClanahan" wrote:

> Jon Stevens wrote:
>
> > This is mostly a question for Craig/Costin.
> >
> > I guess that the new facade stuff has broken a part of Turbine where we were
> > using a reflection hack to get around JSDK 2.0/2.2 issues. With the recent
> > facade stuff checked into Tomcat CVS, we cannot use this trick any longer
> > because the methods are not visible to us any longer.
> >
> > Is there some way that this can be fixed in Tomcat to allow us to do the
> > trick? See below for more details about the problem.
> >
>
> Is there a particular reason you are using getDeclaredMethod() instead of
> getMethod()?  The former looks like it only finds the method if it is actually
> declared in the "outermost" class, while getMethod() will find a superclass's
> implementation if need be.  It is worth trying, anyway.
>
> >
> > -jon
> >
>
> Craig
>
> >
> > ----------
> > From: Sean Legassick <sean@somacity.com>
> > Reply-To: "Turbine" <turbine@list.working-dogs.com>
> > Date: Thu, 15 Jun 2000 20:10:33 +0000
> > To: Turbine <turbine@list.working-dogs.com>
> > Subject: Re: reload fixes
> >
> > On Thu, Jun 15, 2000 at 12:40:20PM -0700, Jon Stevens wrote:
> > > now, what was that other problem we were having with the latest CVS of
> > > tomcat/turbine?
> >
> > The reflection trick in RunDataFactory to call getContextPath is broken
> > now because it is trying to reflect a package-visibility class
> > (HttpServletRequestFacade).
> >
> > > what is the solution?
> >
> > I dunno right now. If there's a clever way anyone knows of fixing the
> > reflection to work that would be best.
> >
> > The workaround I'm using is to remove the reflection and call
> > getContextPath directly. However that won't compile with JSDK2.0, and it
> > doesn't seem to even run with JServ - although I would have thought the
> > 'catch (Exception ex)' would cope (?)
> >
> > My patch is below anyway, but I don't think it should be put in CVS...
> >
> > Sean
> >
> > Index: RunDataFactory.java
> > ===================================================================
> > RCS file:
> > /products/cvs/turbine/turbine/src/java/org/apache/turbine/util/RunDataFactor
> > y.java,v
> > retrieving revision 1.12
> > diff -u -r1.12 RunDataFactory.java
> > --- RunDataFactory.java 2000/05/24 17:22:06 1.12
> > +++ RunDataFactory.java 2000/06/15 20:03:24
> > @@ -132,12 +132,9 @@
> >
> >          // Allow Turbine to work with both 2.2 (and 2.1) and 2.0 Servlet
> > API
> >          String scriptName = null;
> > -        Class jsdkClass = req.getClass();
> >          try
> >          {
> > -            java.lang.reflect.Method meth =
> > -                jsdkClass.getDeclaredMethod("getContextPath", null);
> > -            scriptName = (String)meth.invoke(req, null);
> > +            scriptName = req.getContextPath();
> >          }
> >          catch (Exception ex)
> >          {
> > --
> > Sean Legassick
> > sean@somacity.com
> >
> > ------------------------------------------------------------
> > To subscribe:        turbine-on@list.working-dogs.com
> > To unsubscribe:      turbine-off@list.working-dogs.com
> > Search: <http://www.mail-archive.com/turbine%40list.working-dogs.X-Mozilla-Status:
0009        jon@working-dogs.com
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Mime
View raw message