File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
java/ql/src/semmle/code/java/frameworks/spring Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -105,13 +105,15 @@ class SpringResponseBodyAnnotationType extends AnnotationType {
105105 * A method on a Spring controller that is executed in response to a web request.
106106 */
107107class SpringRequestMappingMethod extends SpringControllerMethod {
108+ Annotation requestMappingAnnotation ;
108109 SpringRequestMappingMethod ( ) {
109110 // Any method that declares the @RequestMapping annotation, or overrides a method that declares
110111 // the annotation. We have to do this explicit check because the @RequestMapping annotation is
111112 // not declared with @Inherited.
112113 exists ( Method superMethod |
113114 this .overrides * ( superMethod ) and
114- superMethod .getAnAnnotation ( ) .getType ( ) instanceof SpringRequestMappingAnnotationType
115+ requestMappingAnnotation = superMethod .getAnAnnotation ( ) and
116+ requestMappingAnnotation .getType ( ) instanceof SpringRequestMappingAnnotationType
115117 )
116118 }
117119
@@ -120,6 +122,11 @@ class SpringRequestMappingMethod extends SpringControllerMethod {
120122 result = getAParameter ( )
121123 }
122124
125+ /** Gets the "produces" @RequestMapping annotation value, if present. */
126+ string getProduces ( ) {
127+ result = requestMappingAnnotation .getValue ( "produces" ) .( StringLiteral ) .getValue ( )
128+ }
129+
123130 /** Holds if this is considered an @ResponseBody method. */
124131 predicate isResponseBody ( ) {
125132 getAnAnnotation ( ) .getType ( ) instanceof SpringResponseBodyAnnotationType
You can’t perform that action at this time.
0 commit comments