Yes ---

<snip>

        ClassLoader classLoader =
Thread.currentThread().getContextClassLoader();
        if (null == classLoader)
        {
                classLoader = this.getClass().getClassLoader();
        }

</snip>



Jerry Jalenak
Development Manager, Web Publishing
LabOne, Inc.
10101 Renner Blvd.
Lenexa, KS  66219
(913) 577-1496

[EMAIL PROTECTED]


> -----Original Message-----
> From: Kris Schneider [mailto:[EMAIL PROTECTED]
> Sent: Monday, June 21, 2004 10:27 AM
> To: Struts Users Mailing List
> Subject: Re: [OT] Accessing Http Request with Groovy
> 
> 
> How is "classLoader" obtained? Is it set to
> Thread.currentThread().getContextClassLoader()?
> 
> Quoting Jerry Jalenak <[EMAIL PROTECTED]>:
> 
> > Hi Guys - 
> > 
> > I know this is a little off topic, but the groovy mailing 
> list doesn't seem
> > to be very active, and I need to track down an answer on 
> this.  What I'm
> > trying to do is call a groovy script from a java class (an 
> Action) and pass
> > over the current Http Request object.  Here's the calling 
> Java code :
> > 
> > <snip>
> > 
> >     GroovyClassLoader groovyClassLoader = new
> > GroovyClassLoader(classLoader);
> >     Class groovyClass =
> > groovyClassLoader.parseClass(form.getValidationScript());
> > 
> >     GroovyObject groovyObject = (GroovyObject)
> > groovyClass.newInstance();
> >     Object[] args = {_request};
> >     validated = ((Boolean) groovyObject.invokeMethod("run",
> > args)).booleanValue();
> > 
> > </snip>
> > 
> > And here's the (very basic) groovy script :
> > 
> > <snip>
> > 
> >     import javax.servlet.http.HttpServletRequest;
> >     public class Validate {
> >             public Boolean run(HttpServletRequest request) {
> >                     println("queryString is " +
> > request.getQueryString());
> >                     return new Boolean(true);
> >             }
> >     }
> > 
> > </snip>
> > 
> > When I run this I'm getting the following error :
> > 
> > java.lang.NoClassDefFoundError:
> > org/apache/coyote/tomcat5/CoyoteRequestFacade
> >     
> > 
> gjdk.org.apache.coyote.tomcat5.CoyoteRequestFacade_GroovyRefle
> ctor.invoke(Co
> > yoteRequestFacade_GroovyReflector.java)
> >     groovy.lang.MetaMethod.invoke(MetaMethod.java:110)
> >     groovy.lang.MetaClass.doMethodInvoke(MetaClass.java:1020)
> >     groovy.lang.MetaClass.invokeMethod(MetaClass.java:314)
> >     
> org.codehaus.groovy.runtime.Invoker.invokeMethod(Invoker.java:139)
> >     
> > 
> org.codehaus.groovy.runtime.InvokerHelper.invokeNoArgumentsMet
> hod(InvokerHel
> > per.java:102)
> >     Validate.run(script1087827061572.groovy:4)
> >     
> gjdk.Validate_GroovyReflector.invoke(Validate_GroovyReflector.java)
> >     groovy.lang.MetaMethod.invoke(MetaMethod.java:110)
> >     groovy.lang.MetaClass.doMethodInvoke(MetaClass.java:1020)
> >     groovy.lang.MetaClass.invokeMethod(MetaClass.java:314)
> >     
> > 
> gjdk.groovy.lang.MetaClass_GroovyReflector.invoke(MetaClass_Gr
> oovyReflector.
> > java)
> >     groovy.lang.MetaMethod.invoke(MetaMethod.java:110)
> >     groovy.lang.MetaClass.doMethodInvoke(MetaClass.java:1020)
> >     groovy.lang.MetaClass.invokeMethod(MetaClass.java:314)
> >     
> org.codehaus.groovy.runtime.Invoker.invokeMethod(Invoker.java:139)
> >     
> > 
> org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(Invoker
> Helper.java:10
> > 6)
> >     Validate.invokeMethod(script1087827061572.groovy)
> >     
> org.appframework.controller.Controller.process(Controller.java:213)
> >     
> org.appframework.controller.Controller.doGet(Controller.java:104)
> >     javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
> >     javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
> > 
> > For some reason groovy is looking for the 
> CoyoteRequestFacade, not the
> > normal javax.servlet.http.HttpServletRequest.  So, for all 
> of you groovy
> > guru's out there, how can I do this?
> > 
> > Thanks!
> > 
> > Jerry Jalenak
> > Development Manager, Web Publishing
> > LabOne, Inc.
> > 10101 Renner Blvd.
> > Lenexa, KS  66219
> > (913) 577-1496
> > 
> > [EMAIL PROTECTED]
> 
> -- 
> Kris Schneider <mailto:[EMAIL PROTECTED]>
> D.O.Tech       <http://www.dotech.com/>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 

This transmission (and any information attached to it) may be confidential and
is intended solely for the use of the individual or entity to which it is
addressed. If you are not the intended recipient or the person responsible for
delivering the transmission to the intended recipient, be advised that you
have received this transmission in error and that any use, dissemination,
forwarding, printing, or copying of this information is strictly prohibited.
If you have received this transmission in error, please immediately notify
LabOne at the following email address: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to