【发布时间】:2017-05-18 00:31:03
【问题描述】:
我想在我的RestController 中解析如下请求
POST http://#.#.#.#:#/report HTTP/1.1
User-Agent: Android
Accept: text/html,application/xml,application/json,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Content-Type: multipart/mixed; boundary=%&REPORT_DIVIDER&%
Authorization: Basic ***
Content-Length: 23236
Host: #.#.#.#:#
Connection: Keep-Alive
Accept-Encoding: gzip
--%&REPORT_DIVIDER&%
Content-Type: application/json
{"content-excluded":true}
--%&REPORT_DIVIDER&%
Content-Disposition: attachment; filename="INSTALLATION"
Content-Type: application/octet-stream
609903cf-fcc0-460c-87db-958e031ac156
--%&REPORT_DIVIDER&%--
此消息符合rfc1341,但我无法在 Spring 中找到解析此消息的方法。
请注意,文件的数量可能会有所不同。
我已经尝试过使用CommonsMultipartResolver 或StandardServletMultipartResolver,但两者都只支持multipart/form-data (rfc1867)。
除了编写自己的解析器之外,还有什么方法可以在 Spring 中解析这些请求?
【问题讨论】:
标签: java spring http spring-mvc multipart