Class QualitySourceMediaType
java.lang.Object
jakarta.ws.rs.core.MediaType
org.glassfish.jersey.message.internal.QualitySourceMediaType
- All Implemented Interfaces:
Qualified
A quality source media type.
- Author:
- Paul Sandoz, Marek Potociar
-
Field Summary
Modifier and TypeFieldDescriptionstatic final Comparator<QualitySourceMediaType>
Comparator for lists of quality source media types.Fields inherited from class jakarta.ws.rs.core.MediaType
APPLICATION_ATOM_XML, APPLICATION_ATOM_XML_TYPE, APPLICATION_FORM_URLENCODED, APPLICATION_FORM_URLENCODED_TYPE, APPLICATION_JSON, APPLICATION_JSON_PATCH_JSON, APPLICATION_JSON_PATCH_JSON_TYPE, APPLICATION_JSON_TYPE, APPLICATION_OCTET_STREAM, APPLICATION_OCTET_STREAM_TYPE, APPLICATION_SVG_XML, APPLICATION_SVG_XML_TYPE, APPLICATION_XHTML_XML, APPLICATION_XHTML_XML_TYPE, APPLICATION_XML, APPLICATION_XML_TYPE, CHARSET_PARAMETER, MEDIA_TYPE_WILDCARD, MULTIPART_FORM_DATA, MULTIPART_FORM_DATA_TYPE, SERVER_SENT_EVENTS, SERVER_SENT_EVENTS_TYPE, TEXT_HTML, TEXT_HTML_TYPE, TEXT_PLAIN, TEXT_PLAIN_TYPE, TEXT_XML, TEXT_XML_TYPE, WILDCARD, WILDCARD_TYPE
-
Constructor Summary
ConstructorDescriptionQualitySourceMediaType
(String type, String subtype) Create new quality source media type instance with adefault quality factor
value.Create new quality source media type instance. -
Method Summary
Modifier and TypeMethodDescriptionboolean
int
Get quality source factor value (in [ppt]).static int
getQualitySource
(MediaType mediaType) Extract quality source information from the suppliedMediaType
value.int
hashCode()
toString()
static QualitySourceMediaType
valueOf
(HttpHeaderReader reader) Create new quality source media type instance from the suppliedHTTP header reader
.Methods inherited from class jakarta.ws.rs.core.MediaType
getParameters, getSubtype, getType, isCompatible, isWildcardSubtype, isWildcardType, valueOf, withCharset
-
Field Details
-
COMPARATOR
Comparator for lists of quality source media types.
-
-
Constructor Details
-
QualitySourceMediaType
Create new quality source media type instance with adefault quality factor
value.- Parameters:
type
- the primary type,null
is equivalent toMediaType.MEDIA_TYPE_WILDCARD
subtype
- the subtype,null
is equivalent toMediaType.MEDIA_TYPE_WILDCARD
-
QualitySourceMediaType
public QualitySourceMediaType(String type, String subtype, int quality, Map<String, String> parameters) Create new quality source media type instance.- Parameters:
type
- the primary type,null
is equivalent toMediaType.MEDIA_TYPE_WILDCARD
subtype
- the subtype,null
is equivalent toMediaType.MEDIA_TYPE_WILDCARD
quality
- quality source factor value in [ppt]. SeeQualified
.parameters
- a map of media type parameters,null
is the same as an empty map.
-
-
Method Details
-
getQuality
public int getQuality()Get quality source factor value (in [ppt]).- Specified by:
getQuality
in interfaceQualified
- Returns:
- quality source factor value.
-
valueOf
Create new quality source media type instance from the suppliedHTTP header reader
.- Parameters:
reader
- HTTP header reader.- Returns:
- new acceptable media type instance.
- Throws:
ParseException
- in case the input data parsing failed.
-
getQualitySource
Extract quality source information from the suppliedMediaType
value. If no quality source parameter is present in the media type,default quality
is returned.- Parameters:
mediaType
- media type.- Returns:
- quality source parameter value or
default quality
, if no quality source parameter is present. - Throws:
IllegalArgumentException
- in case the quality source parameter value could not be parsed.
-
equals
-
hashCode
public int hashCode() -
toString
-