【问题标题】:Receiving both image and JSON in multipart response with Jersey使用 Jersey 在多部分响应中接收图像和 JSON
【发布时间】:2017-12-17 02:51:59
【问题描述】:

我尝试重建服务器的响应以存储接收到的内容(图像和 JSON)。 服务器的代码类似于here 我更改了服务器以返回 TXT​​ 文件,我在客户端上得到了以下内容。

        Response response = client.post(body);
        logger.info("content :" + response.readEntity(String.class));


--Boundary_9_2112219484_1499871974802
Content-Type: text/plain
Content-Disposition: attachement; filename="file1.txt"

Content of file 1
--Boundary_9_2112219484_1499871974802
Content-Type: text/plain
Content-Disposition: attachement; filename="file2.txt"

Content of file 2
--Boundary_9_2112219484_1499871974802--

感谢您的帮助。

【问题讨论】:

  • 能否请您重新表述您的问题。您的意思是说,您也想使用 Cxf 在链接中返回多部分响应作为提供者

标签: java rest jersey cxf multipart


【解决方案1】:

我会尝试对图像进行 base 64 编码,然后将其作为 JSON 中的字符串返回,没有任何问题。

【讨论】:

    猜你喜欢
    • 2016-07-26
    • 1970-01-01
    • 2013-10-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多