Hi Boris.

I do not use asset domains, but a spezialized page that transforms my
parameters into a filelocation (because it's also dependent on user
roles and such).
Page classes may return an Stream instead of rendering a page
template. And of course a stream may contain anything.

We use a file repository outside of tapestry with role specific images
in it, so Assets can't help us here.
Here is an excerpt of our code:


package ch.mycompany.pages;

public class ThumbnailStream{

        @SessionState
    private ProjectState projectState;
    private boolean projectStateExists;
        
    @Inject
    @Path("context:images/default_thumb.png")
    private Asset defaultThumbnail;

        public StreamResponse onActivate() {

         if( !projectStateExists ){
             return getDefaultThumbnail();
         }

        return getThumbnail(projectState.getProjectId());
    }

    private StreamResponse getDefaultThumbnail(){
          try {
              return new
JPEGInline(defaultThumbnail.getResource().openStream());
          } catch (IOException e) {
              return null;
          }
    }
        
        private StreamResponse getThumbnail(Long projectId){
            // TODO something useful
    }
}


The StreamResponse and JPEGInline are custom classes too, you can find
the code here:

http://wiki.apache.org/tapestry/Tapestry5HowToStreamAnExistingBinaryFile


Cheers
Beat



2012/4/14 bhorvat <horvat.z.bo...@gmail.com>:
> I have found some examples of this. And some JIRA reports. Does anyone have
> any idea why this is not included into the tapestry itself? It seems to me
> that this is somewhat important since it is not a good idea to store the
> images into the war file itself.
>
> Any one have any idea if file system approach should be avoided if that is
> why this is not a part of the tapestry itself, especially since there is a
> community desire for it
>
> https://issues.apache.org/jira/browse/TAP5-423
> https://issues.apache.org/jira/browse/TAP5-567
>
> cheers
>
> --
> View this message in context: 
> http://tapestry.1045711.n5.nabble.com/Serving-images-outisde-of-war-in-tapestry-tp5637138p5639915.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> 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

Reply via email to