private String getHttpMethod ( Method method ) { for ( Annotation annotation : method . getAnnotations ( ) ) { Class < ? extends Annotation > annotationClass = annotation . annotationType ( ) ; if ( annotationClass . isAnnotationPresent ( HttpMethod . class ) ) { HttpMethod httpMethod = annotationClass . getAnnotation ( HttpMethod . class ) ; return httpMethod . value ( ) ; } } // default to GET logger . info ( String . format ( "%s.%s does not specify an HTTP method annotation! Defaulting to GET." , method . getClass ( ) . getName ( ) , method . getName ( ) ) ) ; return HttpMethod . GET ; }
Returns the HTTP method for the controller method . Defaults to GET if unspecified .