开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜