Spring REST - Can a RestTemplate consume multipart/mixed?

后端 未结 2 1215
走了就别回头了
走了就别回头了 2021-01-02 22:11

I want to write a REST service which does responed with a zipFile and some json data, everything in one multipart/mixed request.

The server part works fine and i am

2条回答
  •  北荒
    北荒 (楼主)
    2021-01-02 22:55

    I use this solution at the moment:

    @ResponseBody
    @PostMapping(value = JlotApiUrls.PUSH, produces = "application/json")
    public List push ( 
            @PathVariable String projectName,       
            @PathVariable String versionName, 
            @RequestPart("file") MultipartFile multipartFile, 
            @RequestPart("data") @Valid PushForm pushForm 
       ) throws IOException, BindException
    {
     ...
    }
    

    https://github.com/kicktipp/jlot/blob/master/jlot-web/src/main/java/org/jlot/web/api/controller/PushController.java

提交回复
热议问题