【问题标题】:how to download different type of files in rest web service using java如何使用 java 在 REST Web 服务中下载不同类型的文件
【发布时间】:2011-04-08 01:24:40
【问题描述】:

我想下载我使用 java 在 rest web 服务中编写的 @POST 方法的文件。 我与 FileIOStream 一起使用,但我发现我可以下载图像和 zip 文件类型,但文件已损坏。 有谁知道我需要使用哪个库文件来下载各种文件类型。

谢谢。

【问题讨论】:

    标签: java web-services rest file download


    【解决方案1】:

    您需要设置@Produces(或@Consumes)注解来指定发送或接收的数据类型。

    @Consumes({"text/plain,text/html,application/zip"}) 将允许服务接收纯文本、html 和 zip。

    http://download.oracle.com/docs/cd/E19226-01/820-7627/gipxf/index.html

    【讨论】:

      猜你喜欢
      • 2017-11-16
      • 1970-01-01
      • 2013-06-17
      • 2015-06-25
      • 1970-01-01
      • 1970-01-01
      • 2017-12-23
      • 1970-01-01
      • 2012-07-02
      相关资源
      最近更新 更多