You are way over-complicating things. If these are static resources (your webapp/ implies that but storing the names in the db implies the opposite), you can just refer to them by /layout/images/product/<filename> (possibly add a context path). If they are not static resources, e.g. users of your application upload these images, you have to store them outside of the webapplication context path, something like /var/<myapplication>/images/ for example. Then you create a link to the resource and return a stream response to a particular image with something like:
public Link getUploadedProductImage() { return resources.createEventLink("productimage"); } public StreamResponse onUploadedProductImage() throws FileNotFoundException, IOException { return new BufferedImageStreamResponse(ImageIO.read(productImageStorage.getProductImageInputStream(productId))); } Kalle On Mon, Dec 13, 2010 at 1:32 PM, Rich M <rich...@moremagic.com> wrote: > Hi, > > I'm having a hard time figuring out how to dynamically display some images I > have in a sub-path of my webapp/ folder in my Tapestry application > (1.5.0.5). > > I have db entities that store the names of files in a folder in > webapp/layout/images/products/, and in a TML page using a grid, I want to be > able to display these images. > > The only way I was able to get an image to display was to provide a path > like: /app/assets/ctx/1.0/layout/images/products/${prod.imageLink} > > That gave me problems with my Application filter/dispatcher, however, as it > seemed to regard this is a page access outside the scope of the user-session > context and log out the user. > > I'm pretty sure I shouldn't be hardcoding that reference to the asset from a > url anyway, how can I have it load the image through tapestry like all the > other images in the site, like the ones I load through CSS that do not break > the application filter/dispatcher? > > I hope I was clear enough as to what my problem is. > > Thanks, > Rich > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org