classafBedSheet::QualityValues

sys::Obj
  afBedSheet::QualityValues

Parses a Str of HTTP qvalues as per HTTP 1.1 Spec / rfc2616-sec14.3. Provides some useful accessor methods; like `QualityValues.accepts` which returns true only if the name exists AND has a qvalue greater than 0.0.

@see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html

accepts

Source

Bool accepts(Str name)

Returns true if the name was supplied in the header AND has a qvalue > 0.0

This method matches against * wildcards in the qvalue list.

clear

Source

Void clear()

Clears the qvalues

contains

Source

Bool contains(Str name)

Returns true if name was supplied in the header.

This method matches against * wildcards in the qvalue list.

fromStr

Source

static new fromStr(Str? header := null, Bool checked := true)

Parses a HTTP header value into a name:qvalue map. Throws ParseErr if the header Str is invalid.

QualityValues("Accept: audio/*; q=0.2, audio/basic")
get

Source

@Operator
Float get(Str name)

Returns the qvalue associated with name. Defaults to 0 if name was not supplied.

This method matches against * wildcards in the qvalue list, but favours exact match.

isEmpty

Source

Bool isEmpty()

Returns size() == 0

make

Source

static new make(Str:Float qvals)

Creates a new QualityValues instance from the given map.

qvalues

Source

Str:Float qvalues()

Returns a dup of the internal name:qvalue map.

Use get() and set() to modify qvalues.

size

Source

Int size()

Returns the number of values given in the header

toStr

Source

virtual override Str toStr()

Returns a joined-up Str of qvalues that may be set in a HTTP header. The names are sorted by qvalue. Example:

audio/*; q=0.2, audio/basic