I figured it out on my own.  The ???? section below just needs to be replaced
with


        public InputStream getStream() throws IOException {
            return myImageLogo1.getResource().openStream()
        }


Works great!


Ross


ross.efi wrote:
> 
> How do I get an input stream from an injected asset on my page?
> The activation context is which image to use, so I want to stream one
> asset or the other.
> 
> 

>     @Inject
>     @Path( "context:/images/myimage1.png")
>     private Asset myImageLogo1;
> 
>     @Inject
>     @Path( "context:/images/myimage2.png")
>     private Asset myImageLogo2;
> 
>     StreamResponse onActivate( String logoName ) {
>         if ( "logo1".equals( imageName ) {
>             return new StreamResponse() {
> 
>                 public String getContentType() {
>                     return "image/png";
>                 }
> 
>                 public InputStream getStream() throws IOException {
>                     return ????? stream from myImageLogo1 ????
>                 }
> 
>                 public void prepareResponse( Response response ) {
>                     // Nothing needed.
>                 }
>             };
>         }
>         else {  // use image 2
>        }
>     }
> 

> 

-- 
View this message in context: 
http://old.nabble.com/Return-image-asset-from-onActivate-tp27283549p27283617.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

Reply via email to