You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Daniel Jue <te...@gmail.com> on 2007/10/04 16:31:08 UTC
Re: retrieve resource as a stream
Peter, look here and see if this helps:
http://wiki.apache.org/tapestry/Tapestry5HowToCreateADynamicPDF
I use almost the same code for pulling up images. Maybe I should add
it to the wiki.
package com.mycompany.myapp.model.services;
import java.io.InputStream;
import org.apache.log4j.Logger;
public class JPEGGenerator {
private static Logger logger = Logger.getLogger(JPEGGenerator.class);
public static InputStream generateJPEG(String teststring) {
logger.info("generateJPEG()");
return JPEGGenerator.class.getResourceAsStream("/com/mycompany/myapp/pages/lolcats.jpg");
}
}
On 10/4/07, Peter Stavrinides <p....@albourne.com> wrote:
> Hi all,
>
> In tapestry 4, I could retrieve an asset from the context and then use
> it as a stream like this:
>
> @Asset("/XML/irmsitemap.xml")
> public abstract IAsset getNavigationMap();
> InputStream stream = getNavigationMap().getResourceAsStream();
>
> I have tried to convert this code to tapestry 5, but could not find an
> equivalent to getResourceAsStream(), is there an alternate way?
>
> thanks,
> Peter
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org