what about new DefaultClassResolver() ?
Also, what exactly is the relative path to your images? Your
component/images ?
On 3/24/06, Geoff Longman <[EMAIL PROTECTED]> wrote:
>
> Bad me. I'm still on T3.
>
> Geoff
>
> On 3/24/06, Mike Snare <[EMAIL PROTECTED]> wrote:
> > IResourceResolver has been moved to HiveMind as the ClassResolver and
> > the IEngine::getClassResolver method has been deprecated with a
> > statement saying that the better way to get the resolver is to inject
> > it as a service (though I can't find a service-point in hivemind or
> > tapestry that exposes it).
> >
> > Even with that, it doesn't seem to work (I've tried using relative
> > "images" and absolute "/my/component/package/images"). Neither works
> > for me. In the first case I get an application exception saying that
> > "images/progress_0.jpg" can't be found, in the second case it says
> > "/my/component/package/images/progress_0.jpg" can't be found.
> >
> > Any other suggestions or ideas what I might be doing wrong with
> > Geoff's suggestion?
> >
> > Thanks,
> > -Mike
> >
> > On 3/24/06, Geoff Longman <[EMAIL PROTECTED]> wrote:
> > > Just create a new PrivateAsset and return it
> > >
> > > public IAssert getAssert(int percentComplete) {
> > > IResourceResolver = getPage().getEngine().getResourceResolver();
> > > ClasspathResourceLocation imageFolder
> > > = new ClasspathResourceLocation(resolver, "path to images");
> > >
> > > return new PrivateAsset(imageFolder.getRelativeResource(
> String.valueOf(percentComplete)+"/gif"));
> > >
> > > }
> > >
> > > not the most efficent example but you should get the idea.
> > >
> > > Geoff
> > >
> > > On 3/24/06, Mike Snare <[EMAIL PROTECTED]> wrote:
> > > > Sorry. I wasn't clear.
> > > >
> > > > There are 101 of these assets used by my component (one progress bar
> > > > image for each of the possible progress percents between 0 and 100,
> > > > inclusive).
> > > >
> > > > I'd really rather not have to clutter the jwc file with 101 asset
> > > > element statements. I have a method in the component that is called
> > > > via ognl from the jwc file, passing in an object from which I can
> > > > retrieve the percent complete. The method returns an IAsset that is
> > > > used in an Image component.
> > > >
> > > > -Mike
> > > >
> > > > On 3/24/06, Jesse Kuhnert <[EMAIL PROTECTED]> wrote:
> > > > > Yeah it is. You can use the <asset> xml spec method, or the asset
> > > > > annotation. They resolve relatively to your
> component/page/whatever.
> > > > >
> > > > > On 3/24/06, Mike Snare <[EMAIL PROTECTED]> wrote:
> > > > > >
> > > > > > Is there a service/utility that can be used by a page/component
> to
> > > > > > retrieve an asset by relative path?
> > > > > >
> > > > > > I've got it working using the following code:
> > > > > >
> > > > > > private IAsset getPrivateAsset(String relativePath) {
> > > > > >
> > > > > > String path = "/path/to/my/class/" + relativePath;
> > > > > >
> > > > > > // resolver is a DefaultClassResolver
> > > > > > // the asset service is injected
> > > > > > return new PrivateAsset(new ClasspathResource(resolver, path),
> > > > > > getAssetService(), this.getLocation());
> > > > > > }
> > > > > >
> > > > > > But it smells like a hack.
> > > > > >
> > > > > > Thanks,
> > > > > > -Mike
> > > > > >
> > > > > >
> ---------------------------------------------------------------------
> > > > > > To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> > > > > > For additional commands, e-mail:
> [EMAIL PROTECTED]
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > > > --
> > > > > Jesse Kuhnert
> > > > > Tacos/Tapestry, team member/developer
> > > > >
> > > > > Open source based consulting work centered around
> > > > > dojo/tapestry/tacos/hivemind. http://opennotion.com
> > > > >
> > > > >
> > > >
> > > >
> ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > > For additional commands, e-mail:
> [EMAIL PROTECTED]
> > > >
> > > >
> > >
> > >
> > > --
> > > The Spindle guy. http://spindle.sf.net
> > > Blog: http://jroller.com/page/glongman
> > > Other interests: http://www.squidoo.com/spaceelevator/
> > >
> > > ---------------------------------------------------------------------
> > > 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]
> >
> >
>
>
> --
> The Spindle guy. http://spindle.sf.net
> Blog: http://jroller.com/page/glongman
> Other interests: http://www.squidoo.com/spaceelevator/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
--
Jesse Kuhnert
Tacos/Tapestry, team member/developer
Open source based consulting work centered around
dojo/tapestry/tacos/hivemind. http://opennotion.com