private static void parseSuffix ( final MediaRange mr , final String mediaType ) { final String subType = mr . subType ; final int plusIdx = subType . lastIndexOf ( ' ' ) ; if ( plusIdx == 0 ) { throw new InvalidMediaTypeException ( mediaType , "missing subtype for structured media type (" + subType . substring ( 1 ) + ")" ) ; } else if ( plusIdx == subType . length ( ) - 1 ) { throw new InvalidMediaTypeException ( mediaType , "missing suffix for structured media type (" + subType . substring ( 0 , subType . length ( ) - 1 ) + ")" ) ; } else if ( plusIdx > 0 ) { mr . subType = subType . substring ( 0 , plusIdx ) ; mr . suffix = subType . substring ( plusIdx + 1 ) ; } // Otherwise the subtype does not define a structuring syntax. }
As per RFC 6838 Section 4 . 2 structuring syntaxes specifier syntaxes are defined after the last + symbol .