How can I import an image into page class (without advance knowledge of its 
name)?  I would like to use it to stream PDF dynamically. 
 
According to Assets in Component 
Classes(http://tapestry.apache.org/assets.html), components learn about assets 
via injection. The @Inject annotation allows Assets to be injected into 
components as read-only 
properties. The path to the resource is specified using the Path annotation:
 
@Inject
@Path("context:images/tapestry_banner.gif")
private Asset banner;

Assets are located within domains; these domains are identified by the prefix 
on the @Path annotation's value.
 
QUESTION:  What if I do not know filename (tapestry_banner.gif) in advance and 
it is fed to me from database?  In my case, I have several hundred such 
assets...from which I have to select the one I need based on what is tagged in 
the database...it would not be realistic to inject every one of them into page 
(or is it?).  Say all my images are in exactly the same directory called images 
under webapp\layout\images and I get the filename say image001.gif, how could I 
do something like this: 
 
Asset image = createImage([what?]image001.gif);

Reply via email to