Class MediaTypeHelper
java.lang.Object
org.jboss.resteasy.reactive.common.util.MediaTypeHelper
- Author:
- Bill Burke
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final MediaTypeHelper.MediaTypeComparatorstatic final MediaTypeHelper.MediaTypeComparator -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic intcompareMatchingMediaTypes(List<jakarta.ws.rs.core.MediaType> produces, List<jakarta.ws.rs.core.MediaType> mediaTypes1, List<jakarta.ws.rs.core.MediaType> mediaTypes2) static intcompareWeight(jakarta.ws.rs.core.MediaType one, jakarta.ws.rs.core.MediaType two) static booleanequivalent(jakarta.ws.rs.core.MediaType m1, jakarta.ws.rs.core.MediaType m2) static booleanequivalentParams(jakarta.ws.rs.core.MediaType m1, jakarta.ws.rs.core.MediaType m2) static jakarta.ws.rs.core.MediaTypegetBestMatch(List<jakarta.ws.rs.core.MediaType> desired, List<jakarta.ws.rs.core.MediaType> provided) Finds the best match according to the weight of the media types The parameters needs to be sorted, so a copy of these is made if necessary in order to avoid altering the inputstatic jakarta.ws.rs.core.MediaTypegetFirstMatch(List<jakarta.ws.rs.core.MediaType> desired, List<jakarta.ws.rs.core.MediaType> provided) static floatgetQWithParamInfo(jakarta.ws.rs.core.MediaType type) static List<jakarta.ws.rs.core.MediaType>getUngroupedMediaTypes(jakarta.ws.rs.core.MediaType mediaType) This method ungroups the media type with suffix in separated media types.static List<jakarta.ws.rs.core.MediaType>getUngroupedMediaTypes(List<jakarta.ws.rs.core.MediaType> mediaTypes) This method ungroups the media types with suffix in separated media types.static booleanisComposite(String subtype) static booleanisCompositeWildcardSubtype(String subtype) subtypes like application/*+xmlstatic booleanisTextLike(jakarta.ws.rs.core.MediaType mediaType) static booleanisUnsupportedWildcardSubtype(jakarta.ws.rs.core.MediaType mediaType) static booleanisWildcardCompositeSubtype(String subtype) subtypes like application/*+xmlstatic List<jakarta.ws.rs.core.MediaType>parseHeader(String header) static voidsortByQSWeight(List<jakarta.ws.rs.core.MediaType> types) static voidsortByWeight(List<jakarta.ws.rs.core.MediaType> types) static List<jakarta.ws.rs.core.MediaType>toListOfMediaType(String[] mediaTypes)
-
Field Details
-
Q_COMPARATOR
-
QS_COMPARATOR
-
-
Constructor Details
-
MediaTypeHelper
public MediaTypeHelper()
-
-
Method Details
-
getQWithParamInfo
public static float getQWithParamInfo(jakarta.ws.rs.core.MediaType type) -
isCompositeWildcardSubtype
subtypes like application/*+xml- Parameters:
subtype- subtype- Returns:
- true if subtype is composite
-
isWildcardCompositeSubtype
subtypes like application/*+xml- Parameters:
subtype- subtype- Returns:
- true if subtype is wildcard composite
-
isComposite
-
compareWeight
public static int compareWeight(jakarta.ws.rs.core.MediaType one, jakarta.ws.rs.core.MediaType two) -
compareMatchingMediaTypes
-
sortByWeight
-
sortByQSWeight
-
getBestMatch
public static jakarta.ws.rs.core.MediaType getBestMatch(List<jakarta.ws.rs.core.MediaType> desired, List<jakarta.ws.rs.core.MediaType> provided) Finds the best match according to the weight of the media types The parameters needs to be sorted, so a copy of these is made if necessary in order to avoid altering the input -
getFirstMatch
-
parseHeader
-
equivalent
public static boolean equivalent(jakarta.ws.rs.core.MediaType m1, jakarta.ws.rs.core.MediaType m2) -
equivalentParams
public static boolean equivalentParams(jakarta.ws.rs.core.MediaType m1, jakarta.ws.rs.core.MediaType m2) -
isTextLike
public static boolean isTextLike(jakarta.ws.rs.core.MediaType mediaType) -
isUnsupportedWildcardSubtype
public static boolean isUnsupportedWildcardSubtype(jakarta.ws.rs.core.MediaType mediaType) -
toListOfMediaType
-
getUngroupedMediaTypes
public static List<jakarta.ws.rs.core.MediaType> getUngroupedMediaTypes(List<jakarta.ws.rs.core.MediaType> mediaTypes) This method ungroups the media types with suffix in separated media types. For example, having the media type "application/one+two" will return a list containing ["application/one+two", "application/one", "application/two"]. The Media Types without suffix remain as one media type.- Parameters:
mediaTypes- the list of media types to separate.- Returns:
- the list of ungrouped media types.
-
getUngroupedMediaTypes
public static List<jakarta.ws.rs.core.MediaType> getUngroupedMediaTypes(jakarta.ws.rs.core.MediaType mediaType) This method ungroups the media type with suffix in separated media types. For example, having the media type "application/one+two" will return a list containing ["application/one+two", "application/one", "application/two"]. If the Media Type does not have a suffix, then it's not modified.- Parameters:
mediaType- the media type to separate.- Returns:
- the list of ungrouped media types.
-