Welkin1027 opened a new issue, #4266:
URL: https://github.com/apache/servicecomb-java-chassis/issues/4266

   
目前在将一个Springboot项目添加Servicecomb微服务。目前有一个问题,SpringBoot项目中,导出文件需要用到HttpServletResponse,但Servicecomb不支持HttpServletResponse,因此按照文档说明里提到的FilePart类型来下载文件。调用接口时,发生Error:not
 supported method。我将这个方法移植到另一个新开发的springboot+servicecomb项目,是可以成功下载文件的。
   具体方法如下:
   ```
   @RequestMapping(value = "/file/downloadPart", method = RequestMethod.GET)
       @ApiResponses({@ApiResponse(code = 200, response = File.class, message = 
"")})
       public FilePart downloadFilePart(@RequestParam(value = "fileId") String 
fileId) throws FileNotFoundException {
           FilePart filePart = new FilePart(null, new File("test.txt"));
           return filePart;
       }
   ```
   
我分步调试的时候发现,原始的Springboot项目在接到请求时,优先调用了org.springframework.web.method.support.InvocableHandlerMethod里的doInvoke方法;而新开发的项目则是优先调用了org.apache.servicecomb.common.rest.filter.inner.ServerRestArgsFilter的afterReceiveRequest方法,并且没有调用InvocableHandlerMethod的doInvoke方法,而是调用了org.apache.servicecomb.core.handler.impl.ProducerOperationHandler的doInvoke方法。
   
   
我将新项目的@EnableServiceComb注解注释掉之后,发现新项目也和原始项目一样调用了InvocableHandlerMethod的doInvoke方法,并且报出了和原始项目相同的错误。我推测的是,@EnableServiceComb注解能够改变SpringBoot项目的调用逻辑,走了ServerRestArgsFilter和ProducerOperationHandler。但这个注解并没有成功修改原始的SpringBoot项目的调用逻辑,所以想咨询一下原因。
   
   
PS:我已经将原始SpringBoot项目里自带的Filter文件都注释掉了。两个项目使用的springboot都是2.3.0.RELEASE版本,servicecomb则是2.8.9版本


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to