Hi, I have some code that downloads files from both the file system and byte arrays in memory. It was working fine until i did the 6.5.5 upgrade.
I saw this in the release notes
“Application resources now use app:// URLs, similar to how theme resource URLs theme:// urls. Ensure Resource references are passed through the ApplicationConnection.translateVaadinUri() method on the client side. This might affect some add-ons”
.
It sounds like it might be related but seems to be focused at client-widgets,etc so not sure how it might be affecting my code.
This is some of my example code
public class ByteArrayResource extends StreamResource {
private final String filename;
private final String mimeType;
public ByteArrayResource(byte[] byteArray, String name,String mimeType,Application application)
throws FileNotFoundException {
super(new ByteStreamResource(byteArray), name,
application);
this.filename = name;
this.mimeType = mimeType;
}
public DownloadStream getStream() {
DownloadStream stream = new DownloadStream(getStreamSource()
.getStream(), mimeType, filename);
stream.setParameter("Content-Disposition", "attachment;filename=\""
+ filename+"\"");
return stream;
}
private static class ByteStreamResource implements
StreamResource.StreamSource {
private final InputStream inputStream;
public ByteStreamResource(byte[] byteArray)
throws FileNotFoundException {
inputStream = new ByteArrayInputStream(byteArray);
}
public InputStream getStream() {
return inputStream;
}
}
}
and it’s usage:
ByteArrayResource br = new ByteArrayResource(supDoc.getData(),supDoc.getName(),supDoc.getMimeType(),getApplication());
getApplication().getMainWindow().open(br, "_blank");
Any ideas on why this might not be working now?