简体   繁体   English

在Google App Engine中使用Java检索Blob数据(pdf)

[英]Retrieve Blob data (pdf) using java in Google app Engine

I have a database in which there is one field with Blob data. 我有一个数据库,其中有一个包含Blob数据的字段。 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 file. 获取pdf文件。 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: 我只需在您的下载链接中添加target="_blank"属性:

<a target="_blank" href="http://pathtothedownloadservlet">Download this pdf</a>

or, as said by Nick, use the Content Disposition like this: 或者,如Nick所说,使用Content Disposition像这样:

resp.setHeader( "Content-Disposition", "attachment;filename=test.pdf");

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 文件服务是否使用Java将数据作为blob值存储在Google App Engine中 - Does File service stores the data as blob values in Google App Engine using Java 使用Java在Google App Engine中上传的文件未存储为Blob - Uploaded file not storing as blob in google app engine using java 在Google App Engine上解压缩java中的大blob - Decompressing a large blob in java on Google App Engine 如何从URL检索图像并将其存储为Java中的Blob(Google App引擎) - How to I retrieve an image from a URL and store it as a Blob in Java (google app engine) 使用Java刷新App Engine中Blob的内容 - refreshing contents of blob in app engine using java Google App Engine(Java)数据存储区检索不起作用 - Google app engine(java) datastore retrieve not working 在JAVA的Google App Engine上生成带有图片的PDF - Generate PDF with picture on Google App Engine on JAVA 在谷歌应用引擎上为 java 生成和发送 pdf - generating and emailing a pdf on google app engine for java 如何使用Java从Google App Engine下载上传的Blob文件 - how to download an uploaded blob file from google app engine using java 如何使用谷歌应用程序引擎从数据存储区检索信息,并使用Java在Android应用程序的列表视图中显示它? - how to retrieve info from datastore using google app engine and display it in a list view on an android app using java?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM