Java – set the file name of the PDF that flows back to the browser
•
Java
I have a Java webapp to create a PDF and stream it back to the browser
byte[] pdf = report.exportPdfToArray(user); response.setContentType("application/pdf"); response.setHeader("content-disposition","inline; filename=\"My.pdf\""); outStream = response.getOutputStream(); outStream.write(pdf); outStream.flush(); outStream.close();
The report is executed and sent back to the browser, but even if I set the content configuration, I can't control the file name I'm using JBoss 4.2 1. Do you know what I missed?
Edit: is there any way to set the file name when the content disposal is inline?
Solution
Content – disposal: attachment
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码