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 09:20:55 -04:00
parent 5e318e73f8
commit 7c1a2f37f2
2 changed files with 16 additions and 1 deletions

View File

@@ -193,7 +193,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;
}
}