简体   繁体   English

Java Webservices将CSV文件附件作为响应发送

[英]Java Webservices Send the CSV file attachment as Response

I want to send the CSV File as attachment in Java Webservices Response. 我想将CSV文件作为附件发送到Java Webservices响应中。 Can this be done. 可以做到这一点。 Please provide the steps if it is possible 请提供可能的步骤

Set the Content-Disposition header on the response. 在响应上设置Content-Disposition标头。 For example, the headers: 例如,标头:

Content-Disposition: attachment; filename="filename.csv"

...will cause a browser to download the HTTP response entity as a file named "filename.csv". ...将导致浏览器将HTTP响应实体下载为名为“ filename.csv”的文件。 You probably want a MIME type too, which will look like this: 您可能也想要MIME类型,它看起来像这样:

Content-Type: application/csv
Content-Disposition: attachment; filename="filename.csv"

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM