I'm using Vaadin 14 with uploader. When I'm going to save files to /META-INF/resources/audio/MyFolderName/MyFileName.mp3
, then I got this exception message:
java.nio.file.AccessDeniedException: /META-INF
Here is my minimal code:
// Write
String audioPath = "/META-INF/resources/audio/" + seletedLanguage.getValue() + "/" + fileName;
Path path = Paths.get(audioPath);
Files.createDirectories(path.getParent()); // <--- Here I got the error
FileOutputStream fos = new FileOutputStream(audioPath);
fos.write(buffer.getInputStream(fileName).readAllBytes());
fos.close();
// Read
String audioPath = "/META-INF/resources/audio/" + seletedLanguage.getValue() + "/" + foreignSentence + ".mp3";
AbstractStreamResource resource = new StreamResource(foreignSentence, () -> getClass().getResourceAsStream(audioPath));
Where the buffer
is from the MultiFileMemoryBuffer
class.
Can someone tell me if it's possible to have full access to META-INF
folder in Vaadin 14?
My goal is to download files to a folder, where I can use the files later inside my web application.
I'm trying to achieve so I can read and write files from the local drive, e.g projet-folder or something that don't affects the JAR file after I have packed it.