org.apache.any23.servlet.conneg

## Class MediaRangeSpec

- java.lang.Object
- - org.apache.any23.servlet.conneg.MediaRangeSpec

-     public class MediaRangeSpec
      extends Object

  This class implements the HTTP header media-range specification. See RFC 2616 section 14.1.

- - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `MediaRangeSpec` | `getBestMatch(List<MediaRangeSpec> mediaRanges)`
    `String` | `getMediaType()`
    `String` | `getParameter(String parameterName)`
    `List<String>` | `getParameterNames()`
    `int` | `getPrecedence(MediaRangeSpec range)`
    `double` | `getQuality()`
    `String` | `getSubtype()`
    `String` | `getType()`
    `boolean` | `isWildcardSubtype()`
    `boolean` | `isWildcardType()`
    `static List<MediaRangeSpec>` | `parseAccept(String s)` Parses an HTTP Accept header into a List of MediaRangeSpecs
    `static MediaRangeSpec` | `parseRange(String mediaRange)` Parses a media range from a string such as `text/*;charset=utf-8;q=0.9`.
    `static MediaRangeSpec` | `parseType(String mediaType)` Parses a media type from a string such as `text/html;charset=utf-8;q=0.9`.
    `String` | `toString()`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Method Detail

    - #### parseType

          public static MediaRangeSpec parseType(String mediaType)

      Parses a media type from a string such as `text/html;charset=utf-8;q=0.9`.
      Parameters:
        `mediaType` - input string from which to extract mediaType
      Returns:
        `MediaRangeSpec`

    - #### parseRange

          public static MediaRangeSpec parseRange(String mediaRange)

      Parses a media range from a string such as `text/*;charset=utf-8;q=0.9`. Unlike simple media types, media ranges may include wildcards.
      Parameters:
        `mediaRange` - input string from which to extract media range
      Returns:
        `MediaRangeSpec`

    - #### parseAccept

          public static List<MediaRangeSpec> parseAccept(String s)

      Parses an HTTP Accept header into a List of MediaRangeSpecs
      Parameters:
        `s` - an HTTP accept header.
      Returns:
        A List of MediaRangeSpecs

    - #### getType

          public String getType()

    - #### getSubtype

          public String getSubtype()

    - #### getMediaType

          public String getMediaType()

    - #### getParameterNames

          public List<String> getParameterNames()

    - #### getParameter

          public String getParameter(String parameterName)

    - #### isWildcardType

          public boolean isWildcardType()

    - #### isWildcardSubtype

          public boolean isWildcardSubtype()

    - #### getQuality

          public double getQuality()

    - #### getPrecedence

          public int getPrecedence(MediaRangeSpec range)

    - #### getBestMatch

          public MediaRangeSpec getBestMatch(List<MediaRangeSpec> mediaRanges)

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

Copyright © 2010–2019 The Apache Software Foundation. All rights reserved.