You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by GitBox <gi...@apache.org> on 2020/08/12 08:43:19 UTC

[GitHub] [skywalking] BFergerson commented on a change in pull request #5085: Include request method type in rest mapping annotations

BFergerson commented on a change in pull request #5085:
URL: https://github.com/apache/skywalking/pull/5085#discussion_r469101876



##########
File path: apm-sniffer/apm-sdk-plugin/spring-plugins/mvc-annotation-commons/src/main/java/org/apache/skywalking/apm/plugin/spring/mvc/commons/interceptor/RestMappingMethodInterceptor.java
##########
@@ -80,6 +80,20 @@ public String getRequestURL(Method method) {
 
     @Override
     public String getAcceptedMethodTypes(Method method) {
-        return "";
+        return ParsePathUtil.recursiveParseMethodAnnotation(method, m -> {
+            if (AnnotationUtils.getAnnotation(m, GetMapping.class) != null) {
+                return "{GET}";
+            } else if (AnnotationUtils.getAnnotation(m, PostMapping.class) != null) {
+                return "{POST}";
+            } else if (AnnotationUtils.getAnnotation(m, PutMapping.class) != null) {
+                return "{PUT}";
+            } else if (AnnotationUtils.getAnnotation(m, DeleteMapping.class) != null) {
+                return "{DELETE}";
+            } else if (AnnotationUtils.getAnnotation(m, PatchMapping.class) != null) {
+                return "{PATCH}";
+            } else {
+                return "";

Review comment:
       ```suggestion
                   return null;
   ```




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