class ContentTypeValidationDirective {

     public static Route ensureValidContentType(final Set<String> supportedMediaTypes,
             final RequestContext ctx,
             final DittoHeaders dittoHeaders,
             final Supplier<Route> inner) {

         final String requestsMediaType = extractMediaType(ctx.getRequest());
         if (supportedMediaTypes.contains(requestsMediaType)) {
             return inner.get();
         } else {
             if (LOGGER.isInfoEnabled()) {
                 LOGGER.withCorrelationId(dittoHeaders)
                        .info("Request rejected: unsupported media-type: <{}>  request: <{}>", requestsMediaType,
                                requestToLogString(ctx.getRequest()));
             }
             throw UnsupportedMediaTypeException
                     .withDetailedInformationBuilder(requestsMediaType, supportedMediaTypes)
                     .dittoHeaders(dittoHeaders)
                     .build();
         }
     }

     private  ContentTypeValidationDirective();

}