Class ContentTypeUtils

java.lang.Object
com.nimbusds.oauth2.sdk.util.ContentTypeUtils

public final class ContentTypeUtils extends Object
Content type matching.
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    ensureContentType(com.nimbusds.common.contenttype.ContentType expected, com.nimbusds.common.contenttype.ContentType found)
    Ensures the Content-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 the Content-Type of an HTTP header matches an expected value.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • ensureContentType

      public static void ensureContentType(com.nimbusds.common.contenttype.ContentType expected, com.nimbusds.common.contenttype.ContentType found) throws ParseException
      Ensures the Content-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 as charset, are ignored.
      Parameters:
      expected - The expected content type. Must not be null.
      found - The found content type. May be null.
      Throws:
      ParseException - If the found content type is null 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 the Content-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 as charset, are ignored.
      Parameters:
      expected - The expected content type. Must not be null.
      subTypeSuffix - Acceptable suffix if the sub type doesn't match exactly, null if not specified.
      found - The found content type. May be null.
      Throws:
      ParseException - If the found content type is null or doesn't match the expected.