@BeanIgnore public class MediaRanges extends Object
The returned media ranges are sorted such that the most acceptable media is available at ordinal position
The syntax expected to be found in the referenced
Accept = "Accept" ":" #( media-range [ accept-params ] ) media-range = ( "*\/*" | ( type "/" "*" ) | ( type "/" subtype ) ) *( ";" parameter ) accept-params = ";" "q" "=" qvalue *( accept-extension ) accept-extension = ";" token [ "=" ( token | quoted-string ) ]
Constructor and Description |
---|
MediaRanges(HeaderElement[] e)
Constructor.
|
MediaRanges(String value)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
MediaRange |
getRange(int index)
Returns the
MediaRange at the specified index. |
List<MediaRange> |
getRanges()
Returns the media ranges that make up this object.
|
boolean |
hasSubtypePart(String part)
Convenience method for searching through all of the subtypes of all the media ranges in this header for the
presence of a subtype fragment.
|
int |
match(List<? extends MediaType> mediaTypes)
Given a list of media types, returns the best match for this
|
static MediaRanges |
of(String value)
Returns a parsed
|
String |
toString() |
public MediaRanges(String value)
value
- The public MediaRanges(HeaderElement[] e)
e
- The parsed public static MediaRanges of(String value)
value
- The raw public int match(List<? extends MediaType> mediaTypes)
Note that fuzzy matching is allowed on the media types where the
For example, given identical q-values and an
The purpose for this is to allow serializers to match when artifacts such as
mediaTypes
- The media types to match against.public MediaRange getRange(int index)
MediaRange
at the specified index.index
- The index position of the media range.MediaRange
at the specified index or public boolean hasSubtypePart(String part)
For example, given the header hasSubtypePart(
returns
part
- The media type subtype fragment.public List<MediaRange> getRanges()
Copyright © 2016–2020 The Apache Software Foundation. All rights reserved.