if ("GET".equals(method.getHttpMethod())) {
if (!isRequestResponseMethod(method)) {
// ensure GET returns non-void value
if (void.class == method.getMethod().getReturnType()) {
issueList.add(new ResourceModelIssue(
method,
ImplMessages.ERROR_GET_RETURNS_VOID(method.getMethod()),
false));
}
// ensure GET does not consume an entity parameter
if (method.hasEntity()) {
issueList.add(new ResourceModelIssue(
method,
ImplMessages.ERROR_GET_CONSUMES_ENTITY(method.getMethod()),
false));
}
// ensure GET does not consume any @FormParam annotated parameter
for (Parameter p : method.getParameters()) {
if (p.isAnnotationPresent(FormParam.class)) {
issueList.add(new ResourceModelIssue(
method,
ImplMessages.ERROR_GET_CONSUMES_FORM_PARAM(method.getMethod()),
true));
break;
}
}
}
}
// ensure there is not multiple HTTP method designators specified on the method
List<String> httpAnnotList = new LinkedList<String>();
for (Annotation a : method.getMethod().getDeclaredAnnotations()) {
if (null != a.annotationType().getAnnotation(HttpMethod.class)) {
httpAnnotList.add(a.toString());
} else if ((a.annotationType() == Path.class) && !(method instanceof AbstractSubResourceMethod)) {
issueList.add(new ResourceModelIssue(
method, ImplMessages.SUB_RES_METHOD_TREATED_AS_RES_METHOD(method.getMethod(), ((Path)a).value()), false));
}
}
if (httpAnnotList.size() > 1) {
issueList.add(new ResourceModelIssue(
method,
ImplMessages.MULTIPLE_HTTP_METHOD_DESIGNATORS(method.getMethod(), httpAnnotList.toString()),
true));
}
final Type t = method.getGenericReturnType();
if (!isConcreteType(t)) {
issueList.add(new ResourceModelIssue(
method.getMethod(),
"Return type " + t + " of method " + method.getMethod().toGenericString() + " is not resolvable to a concrete type",
false));
}
}