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


Reply via email to