/* RFC 2616: 9.6. The recipient of the entity MUST NOT ignore any * Content-* (e.g. Content-Range) headers that it does not * understand or implement and MUST return a 501 (Not Implemented) * response in such cases. */ private static void checkContentHeader( Collection<String> headerNames, Collection<String> excludes) throws HttpException { outer: for (String headerName : headerNames) { if (headerName.toLowerCase().startsWith("content-")) { for (String exclude : excludes) { if (exclude.equalsIgnoreCase(headerName)) { continue outer; } } throw new HttpException(NOT_IMPLEMENTED.code(), headerName + " is not implemented"); } } }