lujiajing1126 edited a comment on issue #6966:
URL: https://github.com/apache/skywalking/issues/6966#issuecomment-843056889


   > You have a very clear analysis of the issue. But I am not following your 
way of fixing it. Could you be more clear about this?
   
   1. First, we remove the use of `RequestHolder` / `ResponseHolder`
   2. We used to put the `RequestHolder` or `ResponseHolder` in the 
RuntimeContext. Now we directly put the native objects, i.e. 
`javax.servlet.http.HttpServletRequest` or 
`org.springframework.http.server.reactive.ServerHttpResponse` for the request.
   3. Since the only place we use this holder object is in the 
`AbstractMethodInterceptor.java` (Pls correct me if I'm wrong)
   
   
https://github.com/apache/skywalking/blob/47b46f93caf20210995aba7fb6814ed82aeb8260/apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-commons/src/main/java/org/apache/skywalking/apm/plugin/spring/mvc/commons/interceptor/AbstractMethodInterceptor.java#L99-L100
   
   We can check the type of the class on-site with `if`-condition, for example, 
   
   ```java
   Object request = 
ContextManager.getRuntimeContext().get(REQUEST_KEY_IN_RUNTIME_CONTEXT);
   
   if 
(javax.servlet.http.HttpServletRequest.class.isAssignableFrom(request.getClass()))
 {
   ...
   } else if 
(org.springframework.http.server.reactive.ServerHttpRequest.class.isAssignableFrom(request.getClass()))
 {
   ...
   } else {
   throw new UnsupportedOperationException("this line should not be reached");
   }
   ```
   
   Any better idea is welcome.


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