Class MediaRangeList
java.lang.Object
- All Implemented Interfaces:
Serializable,Cloneable,Iterable<MediaRangeList.MediaRange>,Collection<MediaRangeList.MediaRange>,NavigableSet<MediaRangeList.MediaRange>,Set<MediaRangeList.MediaRange>,SortedSet<MediaRangeList.MediaRange>
Deprecated.
Facilitates parsing of the Accept HTTP request header.
See RFC 2616 section 14.1
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassDeprecated.A codeMediaRangerepresents an entry in aMediaRangeList. -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionMediaRangeList(String listStr) Deprecated.Constructs aMediaRangeListusing a list of media ranges specified in ajava.lang.String.MediaRangeList(javax.servlet.http.HttpServletRequest request) Deprecated.Constructs aMediaRangeListusing information from the suppliedHttpServletRequest. -
Method Summary
Modifier and TypeMethodDescriptionbooleanDeprecated.Determines if this MediaRangeList contains a given media type.@Nullable StringDeprecated.Determines which of themediaRangesspecifications is preferred by thisMediaRangeList.@Nullable MediaRangeList.MediaRangeprefer(@NotNull Set<MediaRangeList.MediaRange> mediaRanges) Deprecated.Given a list of media types, returns the one is preferred by thisMediaRangeList.Methods inherited from class java.util.TreeSet
add, addAll, ceiling, clear, clone, comparator, contains, descendingIterator, descendingSet, first, floor, headSet, headSet, higher, isEmpty, iterator, last, lower, pollFirst, pollLast, remove, size, spliterator, subSet, subSet, tailSet, tailSetMethods inherited from class java.util.AbstractSet
equals, hashCode, removeAllMethods inherited from class java.util.AbstractCollection
containsAll, retainAll, toArray, toArray, toStringMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
-
Field Details
-
HEADER_ACCEPT
Deprecated.The Accept HTTP header name.- See Also:
-
PARAM_ACCEPT
Deprecated.The request parameter that overrides the Accept header.- See Also:
-
WILDCARD
Deprecated.The wildcard character for media ranges.- See Also:
-
-
Constructor Details
-
MediaRangeList
public MediaRangeList(javax.servlet.http.HttpServletRequest request) Deprecated.Constructs aMediaRangeListusing information from the suppliedHttpServletRequest. if the request contains aPARAM_ACCEPTquery parameter, the query parameter value overrides anyHEADER_ACCEPTheader value. If the request contains noPARAM_ACCEPTparameter, or the parameter value is empty, the value of theHEADER_ACCEPTis used. If both values are missing, it is assumed that the client accepts all media types, as per the RFC. See alsoMediaRangeList(java.lang.String)- Parameters:
request- TheHttpServletRequestto extract aMediaRangeListfrom
-
MediaRangeList
Deprecated.Constructs aMediaRangeListusing a list of media ranges specified in ajava.lang.String. The string is a comma-separated list of media ranges, as specified by the RFC.
Examples:text/*;q=0.3, text/html;q=0.7, text/html;level=1, text/html;level=2;q=0.4, */*;q=0.5text/html;q=0.8, application/json
- Parameters:
listStr- The list of media range specifications
-
-
Method Details
-
contains
Deprecated.Determines if this MediaRangeList contains a given media type.- Parameters:
mediaType- A string on the formtype/subtype. Neithertypeorsubtypeshould be wildcard (*).- Returns:
trueif thisMediaRangeListcontains a media type that matchesmediaType,falseotherwise- Throws:
IllegalArgumentException- ifmediaTypeis not on an accepted formNullPointerException- ifmediaTypeisnull
-
prefer
@Nullable public @Nullable MediaRangeList.MediaRange prefer(@NotNull @NotNull Set<MediaRangeList.MediaRange> mediaRanges) Deprecated.Given a list of media types, returns the one is preferred by thisMediaRangeList. Wildcards are matched against the offered types. The most specific matching range, including media parameters beforeq, determines each type's quality. Types with quality zero are not acceptable. Accept extensions afterqdo not constrain matching. Equal-quality types follow the ordering of this list; when the same range matches multiple offered types, their iteration order breaks the tie.- Parameters:
mediaRanges- An array of possibleMediaRangeList.MediaRanges- Returns:
- One of the
mediaRangesthat thisMediaRangeListprefers; ornullif thisMediaRangeListdoes not contain any of themediaRanges - Throws:
NullPointerException- ifmediaRangesisnullor contains anullvalue
-
prefer
Deprecated.Determines which of themediaRangesspecifications is preferred by thisMediaRangeList. Offered order breaks ties when multiple types match the same range.- Parameters:
mediaRanges- String representations ofMediaRanges. The strings must be on the form required byMediaRange(String)- Returns:
- the
toString()representation of the preferredMediaRange, ornullif thisMediaRangeListdoes not contain any of themediaRanges - See Also:
-
JakartaMediaRangeListinstead.