Thanks Geoff - just the ticket. 

-----Original Message-----
From: Geoff Longman [mailto:[EMAIL PROTECTED] 
Sent: 31 August 2005 17:56
To: Tapestry users
Subject: Re: Creating an IAsset in code from a context image

public IAsset createAsset(ServletContext context, String path) {
  return new ContextAsset( new ContextResourceLocation(context, path),
null); }

there you go.

Geoff

On 8/31/05, Joe Trewin <[EMAIL PROTECTED]> wrote:
> Hi,
> 
> I'm tring to do a very simple thing, so I'm obviously missing 
> something here (using Tapestry 4).
> 
> I have a method which needs to return an IAsset that points to an 
> image (assume located somewhere in the web context) based on some 
> other parameters. The method is passed the component that requires the
asset.
> 
> I don't want the asset to be formally declared via a component or page

> specification file, as it's determined on the fly.
> 
> How do I do this?
> 
> I've seen hints that point towards using ContextAsset in some way, but

> can not find an obvious way to create one (the constructor takes 
> parameters that I don't know how to obtain, ie.
> "org.apache.hivemind.Resource" and "org.apache.hivemind.Location").
> Likewise with the 'ContextAssetFactory', although I'm not sure if 
> that's designed to be used outside of the core of Tapestry.
> 
> Seems simple enough, but ...
> 
> Any help gratefully recieved.
> 
> (NB. If the code needed to reference an image stored somewhere on the 
> classpath would this be a "private asset". If so, how might the code
> change?)
> 
> Joe
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 


-- 
The Spindle guy.           http://spindle.sf.net
Get help with Spindle:   
http://lists.sourceforge.net/mailman/listinfo/spindle-user
Announcement Feed:    
http://www.jroller.com/rss/glongman?catname=/Announcements
Feature Updates:            http://spindle.sf.net/updates

---------------------------------------------------------------------
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]

Reply via email to