/** * Get Content-Type type provided by the client. * * @param req Request * @return Media type * @throws IOException If fails */ @SuppressWarnings("PMD.AvoidInstantiatingObjectsInLoops") private static MediaTypes getType(final Request req) throws IOException { MediaTypes list = new MediaTypes(); final Iterable<String> headers = new RqHeaders.Base(req).header("Content-Type"); for (final String hdr : headers) { list = list.merge(new MediaTypes(hdr)); } if (list.isEmpty()) { list = new MediaTypes("*/*"); } return list; }