You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by jeff <jl...@houseofdistraction.com> on 2001/03/16 23:01:52 UTC

Re: cvs commit:jakarta-velocity/src/java/org/apache/velocity/servletVelocityServlet.java

"Geir Magnusson Jr." wrote:
> 
> jeff wrote:
> >
> > Daniel Rall wrote:
> > >
> > > geirm@apache.org writes:
> > >
> > > >   @@ -454,9 +457,11 @@
> > > >
> > > >            /*
> > > >             *   put the request/response objects into the context
> > > >   +         *   wrap the HttpServletRequest to solve the introspection
> > > >   +         *   problems
> > > >             */
> > > >
> > > >   -        context.put( REQUEST, request );
> > > >   +        context.put( REQUEST, new HttpServletRequestWrap( request ) );
> > > >            context.put( RESPONSE, response );
> > >
> > > Ahhh...would you mind elaborating?  :)
> >
> > I can attest to this bug.  The class used by Tomcat to implement
> > HttpServletRequest can't be accessed directly in Velocity because it
> > somehow resists introspection.  However, I have had exactly the same
> > experience with HttpServletResponse.  Geir, is there some reason why
> > you've wrapped request but not response?
> 
> I wanted to go to bed, and figured I would save writing another exciting
> gazillion-method wrapper class for another day, so spread out the
> enjoyment. :)
> 
> I am working on the response right now...
> 
> >
> > I wonder if this is a bug in the JVM or if there is some other
> > explanation.
> 
> I am not 100% sure, but I think it is because the class that implements
> the interface is default or private (I don't remember - I looked when
> this was first reported a while ago...)

Even so, it seems like a JVM bug if the class is implementing a public
interface.  Is there some special Java rule that says "introspection no
worky if the implementing class is not public"?

Hmmm, now that I think about it, implemention might be more difficult
wrt security models if introspection had to take interfaces into
account.

Re: cvs commit:jakarta-velocity/src/java/org/apache/velocity/servletVelocityServlet.java

Posted by Daniel Rall <dl...@collab.net>.
jeff <jl...@houseofdistraction.com> writes:

> > "Geir Magnusson Jr." wrote:
> > I am not 100% sure, but I think it is because the class that implements
> > the interface is default or private (I don't remember - I looked when
> > this was first reported a while ago...)
> 
> Even so, it seems like a JVM bug if the class is implementing a public
> interface.  Is there some special Java rule that says "introspection no
> worky if the implementing class is not public"?
> 
> Hmmm, now that I think about it, implemention might be more difficult
> wrt security models if introspection had to take interfaces into
> account.

Right.  The JVM is doing the right thing, as annoying as it is to us
in this case...  ;>
-- 

Daniel Rall <dl...@collab.net>