Package com.nimbusds.oauth2.sdk.util
Class ContentTypeUtils
java.lang.Object
com.nimbusds.oauth2.sdk.util.ContentTypeUtils
Content type matching.
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
ensureContentType
(com.nimbusds.common.contenttype.ContentType expected, com.nimbusds.common.contenttype.ContentType found) Ensures theContent-Type
of an HTTP header matches an expected value.static void
ensureContentType
(com.nimbusds.common.contenttype.ContentType expected, String subTypeSuffix, com.nimbusds.common.contenttype.ContentType found) Ensures theContent-Type
of an HTTP header matches an expected value.
-
Method Details
-
ensureContentType
public static void ensureContentType(com.nimbusds.common.contenttype.ContentType expected, com.nimbusds.common.contenttype.ContentType found) throws ParseException Ensures theContent-Type
of an HTTP header matches an expected value. Note that this method compares only the primary type and subtype; any content type parameters, such ascharset
, are ignored.- Parameters:
expected
- The expected content type. Must not benull
.found
- The found content type. May benull
.- Throws:
ParseException
- If the found content type isnull
or doesn't match the expected.
-
ensureContentType
public static void ensureContentType(com.nimbusds.common.contenttype.ContentType expected, String subTypeSuffix, com.nimbusds.common.contenttype.ContentType found) throws ParseException Ensures theContent-Type
of an HTTP header matches an expected value. Note that this method compares only the primary type and subtype; any content type parameters, such ascharset
, are ignored.- Parameters:
expected
- The expected content type. Must not benull
.subTypeSuffix
- Acceptable suffix if the sub type doesn't match exactly,null
if not specified.found
- The found content type. May benull
.- Throws:
ParseException
- If the found content type isnull
or doesn't match the expected.
-