Unload a XML file

Hi,

I’m try unload file from server using

getApplication().getMainWindow().open(new FileResource(new File(fileName), getApplication()), “Save file”);

but opened window with content of my XML file.

If, file not in xml format, it unload via standard browser dialog.

What i need to do, for upload xml file to client computer?

using vaadin 6.8.0

cheers,
sergey

solution:

        StreamResource.StreamSource source = new StreamResource.StreamSource() {
            public InputStream getStream() {
                try {
                    return new FileInputStream( new File(fileName) );
                } catch (FileNotFoundException ex) {
                    ex.printStackTrace();
                }
                byte[] b = {};
                return new ByteArrayInputStream(b);
            }
        };            
        StreamResource resource = new StreamResource(source, fileName , getApplication());
        resource.setMIMEType("application/octet-stream");

        getApplication().getMainWindow().open(resource,"save dialog");