Fix issue in message conversion

This change ensures that when the Accept and the Producible media types
are equally specific, we use the one from the Accept header, which may
for example carry a different charset.
This commit is contained in:
Rossen Stoyanchev
2012-10-12 08:49:30 -04:00
parent f7943786de
commit dc01f088f7
3 changed files with 15 additions and 31 deletions

View File

@@ -196,7 +196,7 @@ public abstract class AbstractMessageConverterMethodProcessor extends AbstractMe
*/
private MediaType getMostSpecificMediaType(MediaType acceptType, MediaType produceType) {
produceType = produceType.copyQualityValue(acceptType);
return MediaType.SPECIFICITY_COMPARATOR.compare(acceptType, produceType) < 0 ? acceptType : produceType;
return MediaType.SPECIFICITY_COMPARATOR.compare(acceptType, produceType) <= 0 ? acceptType : produceType;
}
}