Class AcceptType
java.lang.Object
org.apache.olingo.commons.api.format.AcceptType
Internally used
AcceptType
for OData library.
See RFC 7231, chapter 5.3.2:
Accept = #( media-range [ accept-params ] ) media-range = ( "*/*" / ( type "/" "*" ) / ( type "/" subtype ) ) *( OWS ";" OWS parameter ) accept-params = weight *( accept-ext ) accept-ext = OWS ";" OWS token [ "=" ( token / quoted-string ) ] weight = OWS ";" OWS "q=" qvalue qvalue = ( "0" [ "." 0*3DIGIT ] ) / ( "1" [ "." 0*3("0") ] )Once created an
AcceptType
is IMMUTABLE.-
Method Summary
Modifier and TypeMethodDescriptionstatic List<AcceptType>
Creates a list ofAcceptType
objects based on given input string.static List<AcceptType>
fromContentType
(ContentType contentType) Creates a list ofAcceptType
objects based on given content type.getParameter
(String name) getType()
boolean
matches
(ContentType contentType) Determines whether this accept type matches a given content type.toString()
-
Method Details
-
create
Creates a list ofAcceptType
objects based on given input string.- Parameters:
acceptTypes
- accept types, comma-separated, as specified for the HTTP headerAccept
- Returns:
- a list of
AcceptType
objects - Throws:
IllegalArgumentException
- if input string is not parseable
-
fromContentType
Creates a list ofAcceptType
objects based on given content type.- Parameters:
contentType
- the content type- Returns:
- an immutable one-element list of
AcceptType
objects that matches only the given content type
-
getType
-
getSubtype
-
getParameters
-
getParameter
-
getQuality
-
toString
-
matches
Determines whether this accept type matches a given content type.
A match is defined as fulfilling all of the following conditions:
- the type must be '*' or equal to the content-type's type,
- the subtype must be '*' or equal to the content-type's subtype,
- all parameters must have the same value as in the content-type's parameter map.
- Parameters:
contentType
- content type against which is matched- Returns:
- whether this accept type matches the given content type
-