public final class AcceptType extends Object
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.Modifier and Type | Method and Description |
---|---|
static List<AcceptType> |
create(String acceptTypes)
Creates a list of
AcceptType objects based on given input string. |
static List<AcceptType> |
fromContentType(ContentType contentType)
Creates a list of
AcceptType objects based on given content type. |
String |
getParameter(String name) |
Map<String,String> |
getParameters() |
Float |
getQuality() |
String |
getSubtype() |
String |
getType() |
boolean |
matches(ContentType contentType)
Determines whether this accept type matches a given content type.
|
String |
toString() |
public static List<AcceptType> create(String acceptTypes)
AcceptType
objects based on given input string.acceptTypes
- accept types, comma-separated, as specified for the HTTP header Accept
AcceptType
objectsIllegalArgumentException
- if input string is not parseablepublic static List<AcceptType> fromContentType(ContentType contentType)
AcceptType
objects based on given content type.contentType
- the content typeAcceptType
objects that matches only the given content typepublic String getType()
public String getSubtype()
public Float getQuality()
public boolean matches(ContentType contentType)
Determines whether this accept type matches a given content type.
A match is defined as fulfilling all of the following conditions:
contentType
- content type against which is matchedCopyright © 2013–2018 The Apache Software Foundation. All rights reserved.