Class ContentTypeUtil


  • public class ContentTypeUtil
    extends Object
    A utility for selecting content types, in the context of the Accept header. ------------------- This does not support matching against content types with extensions, like "level=1", as illustrated in RFC-2616: http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.1 However, as long as we don't offer such extensions on our available types, the use of extensions in the Accept header is moot.
    • Constructor Detail

      • ContentTypeUtil

        public ContentTypeUtil()
    • Method Detail

      • parseAcceptHeader

        public static Set<edu.cornell.mannlib.vitro.webapp.utils.http.ContentTypeUtil.AcceptableType> parseAcceptHeader​(String acceptHeader)
                                                                                                                 throws AcceptHeaderParsingException
        The order of items in the Accept header is not important. We rely on the specificity of the match and the "q" factor, in that order. Since q ranges between 1.0 and 0.001, we add a specificity offset of 2, 3 or 4. That way, matches with equal specificity are decided by q factor.
        Throws:
        AcceptHeaderParsingException