Fix content negotiation issue with sort by q-value

Before this fix the q-value of media types in the Accept header were
ignored when using the new RequestMappingHandlerAdapter in combination
with @ResponseBody and HttpMessageConverters.

Issue: SPR-9160
This commit is contained in:
Rossen Stoyanchev
2012-05-11 14:39:31 -04:00
parent 75578d4e88
commit 982cb2f258
7 changed files with 148 additions and 55 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2011 the original author or authors.
* Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -60,7 +60,7 @@ public class MediaTypeTests {
assertTrue(applicationWildcardXml.includes(applicationSoapXml));
assertFalse(applicationSoapXml.includes(applicationWildcardXml));
}
@Test
public void isCompatible() throws Exception {
MediaType textPlain = MediaType.TEXT_PLAIN;
@@ -102,7 +102,7 @@ public class MediaTypeTests {
public void slashInSubtype() {
new MediaType("text", "/");
}
@Test
public void getDefaultQualityValue() {
MediaType mediaType = new MediaType("text", "plain");
@@ -477,7 +477,7 @@ public class MediaTypeTests {
}
}
}
@Test
public void sortByQualityUnrelated() {
MediaType audioBasic = new MediaType("audio", "basic");
@@ -504,7 +504,7 @@ public class MediaTypeTests {
MediaType mediaType = MediaType.parseMediaType("application/xml");
assertEquals(mediaType, conversionService.convert("application/xml", MediaType.class));
}
@Test
public void isConcrete() {
assertTrue("text/plain not concrete", MediaType.TEXT_PLAIN.isConcrete());