Retrieve Blob data (pdf) using java in Google app Engine
I have a database in which there is one field with Blob data. I want to put the download link on this file. i have used
resp.setContentType("application/pdf");
resp.getOutputStream().write(content.getBytes());
to get the pdf f开发者_开发知识库ile. I am able to get the file but it gets downloaded on the page in which this code is written. I want to put the link with file name and on clicking the link i want to download this file.
I would simply add a target="_blank"
attribute in your download link:
<a target="_blank" href="http://pathtothedownloadservlet">Download this pdf</a>
or, as said by Nick, use the Content Disposition like this:
resp.setHeader( "Content-Disposition", "attachment;filename=test.pdf");
You need to set the Content-Disposition
header.
精彩评论