public static boolean isGrpcContentType ( String contentType ) { if ( contentType == null ) { return false ; } if ( CONTENT_TYPE_GRPC . length ( ) > contentType . length ( ) ) { return false ; } contentType = contentType . toLowerCase ( ) ; if ( ! contentType . startsWith ( CONTENT_TYPE_GRPC ) ) { // Not a gRPC content-type. return false ; } if ( contentType . length ( ) == CONTENT_TYPE_GRPC . length ( ) ) { // The strings match exactly. return true ; } // The contentType matches, but is longer than the expected string. // We need to support variations on the content-type (e.g. +proto, +json) as defined by the // gRPC wire spec. char nextChar = contentType . charAt ( CONTENT_TYPE_GRPC . length ( ) ) ; return nextChar == ' ' || nextChar == ' ' ; }
Indicates whether or not the given value is a valid gRPC content - type .