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/05/12 08:45:42 UTC

[GitHub] [servicecomb-java-chassis] SenixCoder edited a comment on issue #2373: 通过@ModelAttribute注解传递文件聚合对象时,参数拼接在URI中导致header过长

SenixCoder edited a comment on issue #2373:
URL: https://github.com/apache/servicecomb-java-chassis/issues/2373#issuecomment-839587851


   > 哦。 把你的意思理解反了。
   > @FormParam就是从body的form里面提取参数的。 但是你的问题很奇怪, 如果是服务端接收@FormParam, 那么客户端应该把参数使用form传输, 而客户如何构造请求,是客户端决定的。 不应该存在你说的问题。
   > 
   > 所以没太明白你的问题的发生过程是怎么样的。
   
   api如下
   ```public interface EngineElementHotDeployService {
       EngineElementHotDeployResponse hotDeploy(
           @ModelAttribute @Valid @NotNull @ApiParam("request") EngineElementHotDeployRequest request);
   }
   ```
   服务端实现如下
   ```@RestSchema(schemaId = "StudioHotDeployRpcService")
   @RequestMapping(value = ServiceConstants.SERVICE_URL_PREFIX + "/v1/protected/studio/hot-deploy")
   public class StudioHotDeployRpcServiceImpl implements EngineElementHotDeployService {
       @Override
       @PostMapping(produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
       public EngineElementHotDeployResponse hotDeploy(@ModelAttribute EngineElementHotDeployRequest request) {
           validate(request);
           return hotDeployEngine(request);
       }
   }
   ```
   
   客户端调用如下
   ```
   @RpcReference(microserviceName = "xxxx", schemaId = "StudioHotDeployRpcService")
   private ProjectHotDeployApiService hotDeployApiService;    
   
   private void hotDeploy(EngineElementHotDeployRequest request) {
           EngineElementHotDeployResponse response = hotDeployService.hotDeploy(request);
   }
   ```


-- 
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.

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