StreamResource cache time \ Resource Reference

To temporaly resolve an issue I been having with the FileDownloader I am used the setResource and ResourceRefernce to create my PDF files and send them to the client. I also durring my research on solving my problem found the StreamResource setCacheTime method, which I am now using.

The question is how long does the files, which I assume are being created, stay on the server that host the Vaaidin applicaion? Is that time limit set by the cache time that is set on the stream resource?

Thank you

The cache time is how long the browser should cache the resource, not how long the server will hold on to it.

As you are using a stream to send the file, it will just be read from disk and sent to the client without the need to have it all in memory (unless of cource the stream source is in memory, in which case it would get cleared out when its no longer referenced)

The PDF is generate by an application server and sent to the Tomcat server hosting the Vaadin application using SOAP web services. The Vaadin application then converts the data back into a PDF using the code below:

[code]
StreamResource stream = new StreamResource(new StreamSource() {

        @Override
        public InputStream getStream() {
            byte[] pdfBytes = Base64.decodeBase64(pdfData.value.getBytes());
            return new ByteArrayInputStream(pdfBytes);
        }
        
    }, fileName.value);

[/code]That resulting stream resource is then open in a another browser window at this point. Is the stream resource creating a file on disk on the server, or is it just in memory?

Thank you