create a single ClassResourceInfo per class + annotated method
@@ -311,16 +311,28 @@ public final class ResourceUtils {
MethodDispatcher md = new MethodDispatcher();
Class<?> serviceClass = cri.getServiceClass();
+ final Set<Method> annotatedMethods = new HashSet<>();
+
for (Method m : serviceClass.getMethods()) {
Method annotatedMethod = AnnotationUtils.getAnnotatedMethod(serviceClass, m);
+ if (!annotatedMethods.contains(annotatedMethod)) {
+ evaluateResourceMethod(cri, enableStatic, md, m, annotatedMethod);
+ annotatedMethods.add(annotatedMethod);
+ }
+
+ }
+ cri.setMethodDispatcher(md);
+ }
+
+ private static void evaluateResourceMethod(ClassResourceInfo cri, boolean enableStatic, MethodDispatcher md, Method m, Method annotatedMethod) {
String httpMethod = AnnotationUtils.getHttpMethodValue(annotatedMethod);
Path path = AnnotationUtils.getMethodAnnotation(annotatedMethod, Path.class);
if (httpMethod != null || path != null) {
if (!checkAsyncResponse(annotatedMethod)) {
- continue;
+ return;
}
md.bind(createOperationInfo(m, annotatedMethod, cri, path, httpMethod), m);
@@ -348,8 +360,6 @@ public final class ResourceUtils {
reportInvalidResourceMethod(m, NOT_RESOURCE_METHOD_MESSAGE_ID, Level.FINE);
}
}
- cri.setMethodDispatcher(md);
- }
private static void reportInvalidResourceMethod(Method m, String messageId, Level logLevel) {
if (LOG.isLoggable(logLevel)) {
