Update ContentNegotiationManager for unknown path exts
This change refines the logic of "mapping" content negotiation
strategies with regards to how to handle cases where no mapping is
found.
The request parameter strategy now treats request parameter values that
do not match any mapped media type as 406 errors.
The path extension strategy provides a new flag called
"ignoreUnknownExtensions" (true by default) that when set to false also
results in a 406. The same flag is also exposed through the
ContentNegotiationManagerFactoryBean and the MVC Java config.
Issue: SPR-10170
@ -42,8 +44,9 @@ public abstract class AbstractMappingContentNegotiationStrategy extends MappingM
@@ -42,8 +44,9 @@ public abstract class AbstractMappingContentNegotiationStrategy extends MappingM
@ -76,7 +79,7 @@ public abstract class AbstractMappingContentNegotiationStrategy extends MappingM
@@ -76,7 +79,7 @@ public abstract class AbstractMappingContentNegotiationStrategy extends MappingM
@ -59,6 +60,7 @@ public class MappingMediaTypeFileExtensionResolver implements MediaTypeFileExten
@@ -59,6 +60,7 @@ public class MappingMediaTypeFileExtensionResolver implements MediaTypeFileExten
}
}
/**
*FindthefileextensionsmappedtothegivenMediaType.
*@return0ormoreextensions,never{@codenull}
@ -74,6 +76,10 @@ public class MappingMediaTypeFileExtensionResolver implements MediaTypeFileExten
@@ -74,6 +76,10 @@ public class MappingMediaTypeFileExtensionResolver implements MediaTypeFileExten
@ -68,4 +69,8 @@ public class ParameterContentNegotiationStrategy extends AbstractMappingContentN
@@ -68,4 +69,8 @@ public class ParameterContentNegotiationStrategy extends AbstractMappingContentN
@ -65,6 +66,8 @@ public class PathExtensionContentNegotiationStrategy extends AbstractMappingCont
@@ -65,6 +66,8 @@ public class PathExtensionContentNegotiationStrategy extends AbstractMappingCont
@ -82,14 +85,30 @@ public class PathExtensionContentNegotiationStrategy extends AbstractMappingCont
@@ -82,14 +85,30 @@ public class PathExtensionContentNegotiationStrategy extends AbstractMappingCont
@ -108,13 +127,18 @@ public class PathExtensionContentNegotiationStrategy extends AbstractMappingCont
@@ -108,13 +127,18 @@ public class PathExtensionContentNegotiationStrategy extends AbstractMappingCont
@ -64,7 +65,9 @@ public class ServletPathExtensionContentNegotiationStrategy extends PathExtensio
@@ -64,7 +65,9 @@ public class ServletPathExtensionContentNegotiationStrategy extends PathExtensio
@ -60,11 +63,16 @@ public class ContentNegotiationManagerFactoryBeanTests {
@@ -60,11 +63,16 @@ public class ContentNegotiationManagerFactoryBeanTests {
assertEquals("Should be able to resolve file extensions by default",
@ -86,11 +94,26 @@ public class ContentNegotiationManagerFactoryBeanTests {
@@ -86,11 +94,26 @@ public class ContentNegotiationManagerFactoryBeanTests {
@ -103,6 +126,20 @@ public class ContentNegotiationManagerFactoryBeanTests {
@@ -103,6 +126,20 @@ public class ContentNegotiationManagerFactoryBeanTests {
@ -112,7 +149,7 @@ public class ContentNegotiationManagerFactoryBeanTests {
@@ -112,7 +149,7 @@ public class ContentNegotiationManagerFactoryBeanTests {
@ -43,32 +45,37 @@ public class PathExtensionContentNegotiationStrategyTests {
@@ -43,32 +45,37 @@ public class PathExtensionContentNegotiationStrategyTests {
@ -77,45 +84,67 @@ public class PathExtensionContentNegotiationStrategyTests {
@@ -77,45 +84,67 @@ public class PathExtensionContentNegotiationStrategyTests {