EDIT:
Got the directory to live. Now there's another issue in sight:
The files in the storage are stored with their DB id as a prefix to their file names. Of course I don't want the users to see those.
Is there a way to combine the response.redirect and the header setting für filename and size?
best,
A
Hi again,
new approach:
Is it possible to create a IIS like virtual directory within tomcat in order to avoid streaming and only make use of header redirect? I played around with contexts but could'nt get it going...
any ideas?
thx
A
Hi %,
I'm facing a wired issue with the java heap space which is close to bringing me to the ropes.
The short version is:
I've written a ContentManagementSystem which needs to handle huge files (>600mb) too. Tomcat heap settings:
-Xmx700m -Xms400m
The issue is, that uploading huge files works eventhough it's slow. Downloading files results in a java heap space exception.
Trying to download a 370mb file makes tomcat jump to 500mb heap (which should be ok) and end in an Java heap space exception.
I don't get it, why does upload work and download not? Here's my download code:
byte[] byt = new byte[1024*1024*2];
response.setHeader("Content-Disposition", "attachment;filename=\"" + fileName + "\"");
FileInputStream fis = null;
OutputStream os = null;
fis = new FileInputStream(new File(filePath));
os = response.getOutputStream();
BufferedInputStream buffRead = new BufferedInputStream(fis);
while((read = buffRead.read(byt))>0)
{
os.write(byt,0,read);
os.flush();
}
buffRead.close();
os.close();
If I'm getting it right the buffered reader should take care of any memory issue, right?
Any help would be highly appreciated since I ran out of ideas
Best regards,
W