/** * Given a list of media types, returns the best match for this <code>Content-Type</code> header. * * <p> * Note that fuzzy matching is allowed on the media types where the <code>Content-Types</code> header may * contain additional subtype parts. * <br>For example, given a <code>Content-Type</code> value of <js>"text/json+activity"</js>, * the media type <js>"text/json"</js> will match if <js>"text/json+activity"</js> or <js>"text/activity+json"</js> * isn't found. * <br>The purpose for this is to allow parsers to match when artifacts such as <code>id</code> properties are * present in the header. * * @param mediaTypes The media types to match against. * @return The index into the array of the best match, or <code>-1</code> if no suitable matches could be found. */ public int findMatch(MediaType[] mediaTypes) { int matchQuant = 0, matchIndex = -1; for (int i = 0; i < mediaTypes.length; i++) { MediaType mt = mediaTypes[i]; int matchQuant2 = mt.match(this, true); if (matchQuant2 > matchQuant) { matchQuant = matchQuant2; matchIndex = i; } } return matchIndex; } }
/** * Given a list of media types, returns the best match for this <code>Content-Type</code> header. * * <p> * Note that fuzzy matching is allowed on the media types where the <code>Content-Types</code> header may * contain additional subtype parts. * <br>For example, given a <code>Content-Type</code> value of <js>"text/json+activity"</js>, * the media type <js>"text/json"</js> will match if <js>"text/json+activity"</js> or <js>"text/activity+json"</js> * isn't found. * <br>The purpose for this is to allow parsers to match when artifacts such as <code>id</code> properties are * present in the header. * * @param mediaTypes The media types to match against. * @return The index into the array of the best match, or <code>-1</code> if no suitable matches could be found. */ public int findMatch(MediaType[] mediaTypes) { int matchQuant = 0, matchIndex = -1; for (int i = 0; i < mediaTypes.length; i++) { MediaType mt = mediaTypes[i]; int matchQuant2 = mt.match(this, true); if (matchQuant2 > matchQuant) { matchQuant = matchQuant2; matchIndex = i; } } return matchIndex; } }
/** * Given a list of media types, returns the best match for this <code>Content-Type</code> header. * * <p> * Note that fuzzy matching is allowed on the media types where the <code>Content-Types</code> header may * contain additional subtype parts. * <br>For example, given a <code>Content-Type</code> value of <js>"text/json+activity"</js>, * the media type <js>"text/json"</js> will match if <js>"text/json+activity"</js> or <js>"text/activity+json"</js> * isn't found. * <br>The purpose for this is to allow parsers to match when artifacts such as <code>id</code> properties are * present in the header. * * @param mediaTypes The media types to match against. * @return The index into the array of the best match, or <code>-1</code> if no suitable matches could be found. */ public int findMatch(MediaType[] mediaTypes) { int matchQuant = 0, matchIndex = -1; for (int i = 0; i < mediaTypes.length; i++) { MediaType mt = mediaTypes[i]; int matchQuant2 = mt.match(this, true); if (matchQuant2 > matchQuant) { matchQuant = matchQuant2; matchIndex = i; } } return matchIndex; } }
if (forMediaTypes != null) for (MediaType mt2 : forMediaTypes) i = Math.max(i, mt2.match(mt, false)); return i;
if (forMediaTypes != null) for (MediaType mt2 : forMediaTypes) i = Math.max(i, mt2.match(mt, false)); return i;
if (forMediaTypes != null) for (MediaType mt2 : forMediaTypes) i = Math.max(i, mt2.match(mt, false)); return i;
int matchQuant2 = mr.getMediaType().match(mt, false);
int matchQuant2 = mr.getMediaType().match(mt, false);
int matchQuant2 = mr.getMediaType().match(mt, false);
float matchQuant2 = mr.getMediaType().match(mt.getMediaType(), false) * mt.getQValue();
float matchQuant2 = mr.getMediaType().match(mt.getMediaType(), false) * mt.getQValue();
float matchQuant2 = mr.getMediaType().match(mt.getMediaType(), false) * mt.getQValue();