You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by GitBox <gi...@apache.org> on 2021/08/23 06:23:31 UTC

[GitHub] [servicecomb-java-chassis] fanjiang-2021 opened a new issue #2523: 文件上传 附件为空的时候 SDK 会将content-type设置为application/x-www-form-urlencoded

fanjiang-2021 opened a new issue #2523:
URL: https://github.com/apache/servicecomb-java-chassis/issues/2523


   当服务端为外置tomcat的时候报 org.apache.tomcat.util.http.fileupload.impl.InvalidContentTypeException: the request doesn't contain a multipart/form-data or multipart/mixed stream, content type header is application/x-www-form-urlencoded


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [servicecomb-java-chassis] fanjiang-2021 edited a comment on issue #2523: 文件上传 附件为空的时候 SDK 会将content-type设置为application/x-www-form-urlencoded

Posted by GitBox <gi...@apache.org>.
fanjiang-2021 edited a comment on issue #2523:
URL: https://github.com/apache/servicecomb-java-chassis/issues/2523#issuecomment-903479618


   涉及的类org.apache.servicecomb.common.rest.codec.param.RestClientRequestImpl
   走读源码发现:
   当formMap != null 时候,
   ![image](https://user-images.githubusercontent.com/84115877/130400320-8db565ff-b163-4162-a0d4-089700d775a6.png)
   当文件上传的附件为空的时候,不走doEndWithUpload()方法
   ![image](https://user-images.githubusercontent.com/84115877/130400384-7553169e-4896-4c9e-af0d-7edaaa12bcb7.png)
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [servicecomb-java-chassis] fanjiang-2021 commented on issue #2523: 文件上传 附件为空的时候 SDK 会将content-type设置为application/x-www-form-urlencoded

Posted by GitBox <gi...@apache.org>.
fanjiang-2021 commented on issue #2523:
URL: https://github.com/apache/servicecomb-java-chassis/issues/2523#issuecomment-903479618


   涉及的类org.apache.servicecomb.common.rest.codec.param.RestClientRequestImpl
   走读源码发现:
   当formMap != null 时候,
   ![image](https://user-images.githubusercontent.com/84115877/130400320-8db565ff-b163-4162-a0d4-089700d775a6.png)
   当文件上传的附件为空的时候,不走doEndWithUpload()方法


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [servicecomb-java-chassis] liubao68 commented on issue #2523: 文件上传 附件为空的时候 SDK 会将content-type设置为application/x-www-form-urlencoded

Posted by GitBox <gi...@apache.org>.
liubao68 commented on issue #2523:
URL: https://github.com/apache/servicecomb-java-chassis/issues/2523#issuecomment-903484488


   是什么现象? https://github.com/apache/servicecomb-java-chassis/issues/2400  这个问题吗?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [servicecomb-java-chassis] fanjiang-2021 commented on issue #2523: 文件上传 附件为空的时候 SDK 会将content-type设置为application/x-www-form-urlencoded

Posted by GitBox <gi...@apache.org>.
fanjiang-2021 commented on issue #2523:
URL: https://github.com/apache/servicecomb-java-chassis/issues/2523#issuecomment-903591115


   提供端接口定义:
       @PostMapping(path = "/upload", consumes = MediaType.MULTIPART_FORM_DATA)
       public String fileUpload(@RequestPart MultipartFile file, @RequestPart(value = "name", required = true) String name) {
           System.out.println(name);
           return "Upload success ...";
   消费端 调用逻辑:
           HttpHeaders headers = new HttpHeaders();
           headers.setContentType(MediaType.MULTIPART_FORM_DATA);
           params.put("name", "fjw");
           HttpEntity<Map<String, Object>> entity = new HttpEntity<>(params, headers);
           String url = "cse://gray-svc/rest/file/upload?name=fjw";
           String forObject = restTemplate.postForObject(url, entity, String.class);
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@servicecomb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org