Package org.apache.juneau.http.header
Class BasicStringRangesHeader
java.lang.Object
org.apache.juneau.http.header.BasicHeader
org.apache.juneau.http.header.BasicStringRangesHeader
- All Implemented Interfaces:
- Serializable,- Cloneable,- Header,- NameValuePair
- Direct Known Subclasses:
- AcceptCharset,- AcceptEncoding,- AcceptLanguage,- ContentDisposition,- TE
Category of headers that consist of simple comma-delimited lists of strings with q-values.
 
Example
Accept-Encoding: compress;q=0.5, gzip;q=1.0
See Also:
- 
Constructor SummaryConstructorsConstructorDescriptionBasicStringRangesHeader(String name, String value) Constructor.BasicStringRangesHeader(String name, Supplier<StringRanges> value) Constructor with delayed value.BasicStringRangesHeader(String name, StringRanges value) Constructor.
- 
Method SummaryModifier and TypeMethodDescriptionReturns the header value as aStringRangeswrapped in anOptional.getRange(int index) Returns theMediaRangeat the specified index.getValue()intGiven a list of media types, returns the best match for this string range header.static BasicStringRangesHeaderStatic creator.static BasicStringRangesHeaderof(String name, Supplier<StringRanges> value) Static creator with delayed value.static BasicStringRangesHeaderof(String name, StringRanges value) Static creator.orElse(StringRanges other) Return the value if present, otherwise returnother .Returns the header value as aStringRanges.Methods inherited from class org.apache.juneau.http.header.BasicHeaderassertName, assertStringValue, asString, equals, equalsIgnoreCase, get, getElements, getName, hashCode, isNotEmpty, isPresent, of, of, orElse, toString
- 
Constructor Details- 
BasicStringRangesHeaderConstructor.- Parameters:
- name- The header name.
- value- The header value.
 Must be parsable by- StringRanges.of(String).
 Can be- null .
- Throws:
- IllegalArgumentException- If name is- null or empty.
 
- 
BasicStringRangesHeaderConstructor.- Parameters:
- name- The header name.
- value- The header value.
 Can be- null .
- Throws:
- IllegalArgumentException- If name is- null or empty.
 
- 
BasicStringRangesHeaderConstructor with delayed value.Header value is re-evaluated on each call to getValue().- Parameters:
- name- The header name.
- value- The supplier of the header value.
 Can be- null .
- Throws:
- IllegalArgumentException- If name is- null or empty.
 
 
- 
- 
Method Details- 
ofStatic creator.- Parameters:
- name- The header name.
- value- The header value.
 Must be parsable by- StringRanges.of(String).
 Can be- null .
- Returns:
- A new header bean, or null if the value isnull .
- Throws:
- IllegalArgumentException- If name is- null or empty.
 
- 
ofStatic creator.- Parameters:
- name- The header name.
- value- The header value.
 Can be- null .
- Returns:
- A new header bean, or null if the value isnull .
- Throws:
- IllegalArgumentException- If name is- null or empty.
 
- 
ofStatic creator with delayed value.Header value is re-evaluated on each call to getValue().- Parameters:
- name- The header name.
- value- The supplier of the header value.
 Can be- null .
- Returns:
- A new header bean, or null if the value isnull .
- Throws:
- IllegalArgumentException- If name is- null or empty.
 
- 
getValue- Specified by:
- getValuein interface- NameValuePair
- Overrides:
- getValuein class- BasicHeader
 
- 
asStringRangesReturns the header value as aStringRangeswrapped in anOptional.- Returns:
- The header value as a StringRangeswrapped in anOptional. Nevernull .
 
- 
toStringRangesReturns the header value as aStringRanges.- Returns:
- The header value as a StringRanges. Can benull .
 
- 
matchGiven a list of media types, returns the best match for this string range header.Note that fuzzy matching is allowed on the media types where the string range header may contain additional subtype parts. 
 For example, given identical q-values and an string range value of"text/json+activity" , the media type"text/json" will match if"text/json+activity" or"text/activity+json" isn't found.
 The purpose for this is to allow serializers to match when artifacts such asid properties are present in the header.- Parameters:
- names- The names to match against.
- Returns:
- The index into the array of the best match, or -1 if no suitable matches could be found.
 
- 
getRangeReturns theMediaRangeat the specified index.- Parameters:
- index- The index position of the media range.
- Returns:
- The MediaRangeat the specified index ornull if the index is out of range.
 
- 
orElseReturn the value if present, otherwise returnother .This is a shortened form for calling asArray().orElse( .other )- Parameters:
- other- The value to be returned if there is no value present, can be- null .
- Returns:
- The value, if present, otherwise other .
 
 
-