Search in sources :

Example 1 with MediaRange

use of org.apache.jena.atlas.web.MediaRange in project jena by apache.

the class ConNeg method match.

/**
 * Match a single media type against a header string.
 *
 * @param headerString HTTP header string
 * @param mediaRangeStr Semi-colon separated list of media types
 * @return the matched media type or <code>null</code> if there was no match
 */
public static String match(String headerString, String mediaRangeStr) {
    AcceptList l = new AcceptList(headerString);
    // MediaType
    MediaRange aItem = new MediaRange(mediaRangeStr);
    MediaType m = l.match(aItem);
    if (m == null)
        return null;
    return m.toHeaderString();
}
Also used : MediaType(org.apache.jena.atlas.web.MediaType) MediaRange(org.apache.jena.atlas.web.MediaRange) AcceptList(org.apache.jena.atlas.web.AcceptList)

Example 2 with MediaRange

use of org.apache.jena.atlas.web.MediaRange in project jena by apache.

the class ConNeg method match.

/**
     * Match a single media type against a header string.
     *
     * @param headerString HTTP header string
     * @param mediaRangeStr Semi-colon separated list of media types
     * @return the matched media type or <code>null</code> if there was no match
     */
public static String match(String headerString, String mediaRangeStr) {
    AcceptList l = new AcceptList(headerString);
    // MediaType
    MediaRange aItem = new MediaRange(mediaRangeStr);
    MediaType m = l.match(aItem);
    if (m == null)
        return null;
    return m.toHeaderString();
}
Also used : MediaType(org.apache.jena.atlas.web.MediaType) MediaRange(org.apache.jena.atlas.web.MediaRange) AcceptList(org.apache.jena.atlas.web.AcceptList)

Aggregations

AcceptList (org.apache.jena.atlas.web.AcceptList)2 MediaRange (org.apache.jena.atlas.web.MediaRange)2 MediaType (org.apache.jena.atlas.web.MediaType)2