ResponseBuilder builder = Response.ok();
final Set<String> supportedMethods = new HashSet<String>();
for (Method candidateMethod : candidateMethods) {
Annotation[] declaredAnnotations = candidateMethod.getDeclaredAnnotations();
for (Annotation annotation : declaredAnnotations) {
final HttpMethod httpMethod = annotation.annotationType().getAnnotation(HttpMethod.class);
if (httpMethod != null) {
supportedMethods.add(httpMethod.value());
}
}
}
final String allowHeader = concateNameWithComa(supportedMethods);
builder.header(HeaderName.ALLOW.toString(), allowHeader);