Module io.inverno.mod.http.base
Class AcceptCodec.Accept.MediaRange
java.lang.Object
io.inverno.mod.http.base.internal.header.AcceptCodec.Accept.MediaRange
- All Implemented Interfaces:
Headers.Accept.MediaRange
- Enclosing class:
AcceptCodec.Accept
public static class AcceptCodec.Accept.MediaRange
extends Object
implements Headers.Accept.MediaRange
Headers.Accept.MediaRange implementation.
- Since:
- 1.0
- Author:
- Jeremy Kuhn
-
Field Summary
Fields inherited from interface io.inverno.mod.http.base.header.Headers.Accept.MediaRange
COMPARATOR -
Constructor Summary
ConstructorsConstructorDescriptionMediaRange(String mediaType, float weight, Map<String, String> parameters) Creates a media range with the specified media type, quality value and parameters.Creates a media range with the specified type, sub-type, quality value and parameters. -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns the media range raw value.Returns media range parameters.intgetScore()Calculates and returns the score or the media range used for sorting.Returns the media range sub-type.getType()Returns the media range type.floatReturns the media range quality value as defined by RFC 7231 Section 5.3.1.inthashCode()Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.inverno.mod.http.base.header.Headers.Accept.MediaRange
matches
-
Constructor Details
-
MediaRange
Creates a media range with the specified media type, quality value and parameters.
- Parameters:
mediaType- a media typeweight- a quality valueparameters- a map of parameters
-
MediaRange
Creates a media range with the specified type, sub-type, quality value and parameters.
- Parameters:
type- a typesubType- a sub-typeweight- a quality valueparameters- a map of parameters
-
-
Method Details
-
getMediaType
Description copied from interface:Headers.Accept.MediaRangeReturns the media range raw value.
- Specified by:
getMediaTypein interfaceHeaders.Accept.MediaRange- Returns:
- the raw media range
-
getType
Description copied from interface:Headers.Accept.MediaRangeReturns the media range type.
- Specified by:
getTypein interfaceHeaders.Accept.MediaRange- Returns:
- the media range type
-
getSubType
Description copied from interface:Headers.Accept.MediaRangeReturns the media range sub-type.
- Specified by:
getSubTypein interfaceHeaders.Accept.MediaRange- Returns:
- the media range sub-type
-
getWeight
public float getWeight()Description copied from interface:Headers.Accept.MediaRangeReturns the media range quality value as defined by RFC 7231 Section 5.3.1.
- Specified by:
getWeightin interfaceHeaders.Accept.MediaRange- Returns:
- the media range quality value
-
getScore
public int getScore()Description copied from interface:Headers.Accept.MediaRangeCalculates and returns the score or the media range used for sorting.
The score is calculated by assigning a score to the media range part and add all:
- the range quality value is multiplied by 1000
- */* is worth 0
- */x is worth 10
- x/* is worth 20
- x/x is worth 30
- a null parameter is worth 1
- a non-null parameter is worth 2
- Specified by:
getScorein interfaceHeaders.Accept.MediaRange- Returns:
- the score of the media range
-
getParameters
Description copied from interface:Headers.Accept.MediaRangeReturns media range parameters.
- Specified by:
getParametersin interfaceHeaders.Accept.MediaRange- Returns:
- the media range parameters
-
hashCode
public int hashCode() -
equals
-