public boolean accepts(ResourceMethod method) {
return method.containsAnnotation(Consumes.class);
}
public void intercept(InterceptorStack stack, ResourceMethod method, Object resourceInstance) throws InterceptionException {
Consumes consumesAnnotation = method.getMethod().getAnnotation(Consumes.class);
List<String> supportedMimeTypes = Arrays.asList(consumesAnnotation.value());
String contentType = request.getContentType();
if (!supportedMimeTypes.contains(contentType)) {
String errorMessage = String.format("Request with media type [%s]. Expecting one of %s.",
contentType, supportedMimeTypes);