Package com.helger.http.header.specific
Class AcceptMimeTypeList
java.lang.Object
com.helger.http.header.AbstractQValueList<com.helger.mime.IMimeType>
com.helger.http.header.specific.AcceptMimeTypeList
@NotThreadSafe
public class AcceptMimeTypeList
extends AbstractQValueList<com.helger.mime.IMimeType>
Represents a list of "Accept" HTTP header values, created e.g. by the
AcceptMimeTypeHandler.- Author:
- Philip Helger
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddMimeType(com.helger.mime.IMimeType aMimeType, double dQuality) addMimeType(String sMimeType, double dQuality) booleanexplicitlySupportsMimeType(com.helger.mime.IMimeType aMimeType) Check if the passed MIME type is supported, without considering fallback MIME types (xxx/*)booleanexplicitlySupportsMimeType(String sMimeType) Check if the passed MIME type is supported, without considering fallback MIME types (xxx/*)com.helger.mime.IMimeTypegetPreferredMimeType(com.helger.mime.IMimeType... aMimeTypes) Pick the preferred mime type of the provided list of mime types.doublegetQualityOfMimeType(com.helger.mime.IMimeType aMimeType) Return the associated quality of the given MIME type using the fallback mechanism.doublegetQualityOfMimeType(String sMimeType) Return the associated quality of the given MIME type using the fallback mechanism.getQValueOfMimeType(com.helger.mime.IMimeType aMimeType) Return the associated quality of the given MIME type using the fallback mechanism.booleansupportsMimeType(com.helger.mime.IMimeType aMimeType) Check if the passed MIME type is supported, incl. fallback handlingbooleansupportsMimeType(String sMimeType) Check if the passed MIME type is supported, incl. fallback handlingMethods inherited from class com.helger.http.header.AbstractQValueList
equals, getAllQValues, getAllQValuesGreaterOrEqual, getAllQValuesGreaterThan, getAllQValuesLowerOrEqual, getAllQValuesLowerThan, getAsHttpHeaderValue, getAsHttpHeaderValue, hashCode, qvalueMap, toString
-
Constructor Details
-
AcceptMimeTypeList
public AcceptMimeTypeList()
-
-
Method Details
-
addMimeType
@Nonnull public AcceptMimeTypeList addMimeType(@Nonnull @Nonempty String sMimeType, @Nonnegative double dQuality) throws com.helger.mime.parse.MimeTypeParserException - Throws:
com.helger.mime.parse.MimeTypeParserException
-
addMimeType
@Nonnull public AcceptMimeTypeList addMimeType(@Nonnull com.helger.mime.IMimeType aMimeType, @Nonnegative double dQuality) -
getQValueOfMimeType
Return the associated quality of the given MIME type using the fallback mechanism.- Parameters:
aMimeType- The charset name to query. May not benull.- Returns:
- The
QValueof the mime type
-
getQualityOfMimeType
Return the associated quality of the given MIME type using the fallback mechanism.- Parameters:
sMimeType- The MIME type name to query. May benull.- Returns:
- 0 means not accepted, 1 means fully accepted. If the passed MIME type is invalid, the "not accepted" quality is returned.
-
getQualityOfMimeType
public double getQualityOfMimeType(@Nullable com.helger.mime.IMimeType aMimeType) Return the associated quality of the given MIME type using the fallback mechanism.- Parameters:
aMimeType- The MIME type to query. May benull.- Returns:
- 0 means not accepted, 1 means fully accepted. If the passed MIME type is
null, the "not accepted" quality is returned.
-
supportsMimeType
Check if the passed MIME type is supported, incl. fallback handling- Parameters:
sMimeType- The MIME type to check- Returns:
trueif it is supported,falseif not
-
supportsMimeType
public boolean supportsMimeType(@Nullable com.helger.mime.IMimeType aMimeType) Check if the passed MIME type is supported, incl. fallback handling- Parameters:
aMimeType- The MIME type to check. May benull.- Returns:
trueif it is supported,falseif not
-
explicitlySupportsMimeType
Check if the passed MIME type is supported, without considering fallback MIME types (xxx/*)- Parameters:
sMimeType- The MIME type to check- Returns:
trueif it is supported,falseif not
-
explicitlySupportsMimeType
public boolean explicitlySupportsMimeType(@Nullable com.helger.mime.IMimeType aMimeType) Check if the passed MIME type is supported, without considering fallback MIME types (xxx/*)- Parameters:
aMimeType- The MIME type to check. May benull.- Returns:
trueif it is supported,falseif not
-
getPreferredMimeType
@Nullable public com.helger.mime.IMimeType getPreferredMimeType(@Nonnull com.helger.mime.IMimeType... aMimeTypes) Pick the preferred mime type of the provided list of mime types.- Parameters:
aMimeTypes- The MIME type array to be used. May benull.- Returns:
nullif no matching MIME type was found.- Since:
- 9.6.4
- See Also:
-
getAsHttpHeaderValue
- Specified by:
getAsHttpHeaderValuein classAbstractQValueList<com.helger.mime.IMimeType>- Returns:
- The string representation of this list e.g. for usage in HTTP headers.
-