Ok , I found a solution
I didn't remember what I did when I  need to display a chart with T5  

I create my own StreamResponse  
look at it :

public class FileComponent {
        
        @Inject
        private ComponentResources _resources;

        @SuppressWarnings("unused")
        @Mixin
        private RenderInformals _renderInformals;

        @Environmental
        private PageRenderSupport _support;

        @BeginRender
        public Boolean beginRender(MarkupWriter writer) {
           String fileName = "helloWorld.txt"
                Link link =
_resources.createActionLink(org.apache.tapestry.TapestryConstants.ACTION_EVENT,
false, fileName );

                writer.element("a", "href", link.toURI());
                writer.write(fileName);
                writer.end();
                
                return false ;
        }


        @OnEvent 
        public StreamResponse renderChart() throws IOException,
SprintNotFoundException {
                return new FileStreamResponse(String) ;
        }
        
        private class FileStreamResponse implements StreamResponse {
                
                public FileStreamResponse(String path) {
            pathToYourFile = path ;
                }

                public String getContentType() {
                   //You should know the contentType of the file to be
downloaded
                        return "application/octet-stream";
                }

                public InputStream getStream() throws IOException {
                        FileInputStream stream = new FileInputStream(new 
File(pathToYourFile)) ;
                        return stream;
                }

                public void prepareResponse(Response arg0) {
                }
                
        }
}






Fidel Chavarria wrote:
> 
> I need to create external assets for files that has been loaded to my
> server with the t5 upload component,
> these files are located in the file system of the server and they need to
> be downloaded from an user.
> 
> any suggestion ...? 
> 

-- 
View this message in context: 
http://www.nabble.com/T5%3A-How-can-I-create-an-external-Asset-tf4590286.html#a13107575
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to