I'm not sure if this is what you're looking for, but one trick I use
to load resources from time to time is:
Step 1: Put the resource in a known package.
Step 2: Put some class, any class, in that package.
Step 3: Get a classloader for that marker class with:
ClassLoader cl = MarkerClass.class.getClassLoader();
At this point, you're guaranteed to have a classloader which can
load from your package because your MarkerClass came out of that package.
From there, you can load resources with:
InputStream is = cl.getResourceAsStream(<objectname>);
I've never had a problem with this approach, either in development
or deployment, but whenever I try to trust the default classloaders I end up
with some heavy voodoo during deployment cycles.
--- Pat
> -----Original Message-----
> From: Norbert Sándor [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, October 04, 2005 1:26 PM
> To: Tapestry users
> Subject: Re: injecting services in ASO's
>
> It would be nice to have a special classloader which enhances arbitrary
> classes (I mean not only components) based on it's annotations.
> Does anyone know about such ClassLoader or ClassFileTransformer?
>
> I have a very ugly but working "solution" for this: I subclassed
> ApplicationServlet and I store the registry in a threadlocal at the
> beginning of every request. So if I need a service outside of hivemind's
> scope, I simply get the registry from the threadlocal and request the
> service by name. I told it's ugly :D
>
> I would be happy if someone would have a nicer solution :)
>
> BR,
> Norbi
>
> ----- Original Message -----
> From: "Dan Adams" <[EMAIL PROTECTED]>
> To: "Tapestry users" <[email protected]>
> Sent: Tuesday, October 04, 2005 8:38 PM
> Subject: injecting services in ASO's
>
>
> > Does anyone know how to inject a service into an ASO? I'm really havin
> > some trouble with this.
> >
> > --
> > Dan Adams
> > Software Engineer
> > Interactive Factory
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> >
> >
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]