【问题标题】:Download different content types with spring使用 spring 下载不同的内容类型
【发布时间】:2020-12-01 11:51:04
【问题描述】:

我需要公开一个 POST 端点,用户在该端点上传一个 excel 文件,并基于一些验证,我要么将添加了一些信息的文件连同 json 响应一起发回,要么只发送状态代码为 200 OK(无数据)。 我正在尝试在 Spring Boot 中执行此操作。我尝试了以下链接:
https://javadigest.wordpress.com/2012/02/13/downloading-multiple-files-using-multipart-response/
这可行,但需要手动添加边界。有没有其他方法可以发送数据?

【问题讨论】:

    标签: spring spring-boot


    【解决方案1】:

    你应该使用@Produces,因为它写在这里:https://docs.oracle.com/cd/E19776-01/820-4867/ghrpv/index.html

    您可以定义负载的 MIME 类型。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-08-14
      • 2011-08-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多