Consistent configurer access in WebMvcConfigurationSupport
Issue: SPR-16017
This commit is contained in:
@@ -39,6 +39,7 @@ import org.springframework.web.context.request.NativeWebRequest;
|
||||
* {@code MediaTypeFileExtensionResolver} instances.
|
||||
*
|
||||
* @author Rossen Stoyanchev
|
||||
* @author Juergen Hoeller
|
||||
* @since 3.2
|
||||
*/
|
||||
public class ContentNegotiationManager implements ContentNegotiationStrategy, MediaTypeFileExtensionResolver {
|
||||
@@ -65,6 +66,7 @@ public class ContentNegotiationManager implements ContentNegotiationStrategy, Me
|
||||
* A collection-based alternative to
|
||||
* {@link #ContentNegotiationManager(ContentNegotiationStrategy...)}.
|
||||
* @param strategies the strategies to use
|
||||
* @since 3.2.2
|
||||
*/
|
||||
public ContentNegotiationManager(Collection<ContentNegotiationStrategy> strategies) {
|
||||
Assert.notEmpty(strategies, "At least one ContentNegotiationStrategy is expected");
|
||||
@@ -95,7 +97,7 @@ public class ContentNegotiationManager implements ContentNegotiationStrategy, Me
|
||||
/**
|
||||
* Find a {@code ContentNegotiationStrategy} of the given type.
|
||||
* @param strategyType the strategy type
|
||||
* @return the first matching strategy or {@code null}.
|
||||
* @return the first matching strategy, or {@code null} if none
|
||||
* @since 4.3
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
* Copyright 2002-2017 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.
|
||||
@@ -85,6 +85,7 @@ import org.springframework.web.context.ServletContextAware;
|
||||
* extension to a MediaType. You may {@link #setUseJaf suppress} the use of JAF.
|
||||
*
|
||||
* @author Rossen Stoyanchev
|
||||
* @author Brian Clozel
|
||||
* @since 3.2
|
||||
*/
|
||||
public class ContentNegotiationManagerFactoryBean
|
||||
@@ -255,8 +256,7 @@ public class ContentNegotiationManagerFactoryBean
|
||||
if (this.favorPathExtension) {
|
||||
PathExtensionContentNegotiationStrategy strategy;
|
||||
if (this.servletContext != null && !isUseJafTurnedOff()) {
|
||||
strategy = new ServletPathExtensionContentNegotiationStrategy(
|
||||
this.servletContext, this.mediaTypes);
|
||||
strategy = new ServletPathExtensionContentNegotiationStrategy(this.servletContext, this.mediaTypes);
|
||||
}
|
||||
else {
|
||||
strategy = new PathExtensionContentNegotiationStrategy(this.mediaTypes);
|
||||
@@ -269,8 +269,7 @@ public class ContentNegotiationManagerFactoryBean
|
||||
}
|
||||
|
||||
if (this.favorParameter) {
|
||||
ParameterContentNegotiationStrategy strategy =
|
||||
new ParameterContentNegotiationStrategy(this.mediaTypes);
|
||||
ParameterContentNegotiationStrategy strategy = new ParameterContentNegotiationStrategy(this.mediaTypes);
|
||||
strategy.setParameterName(this.parameterName);
|
||||
strategies.add(strategy);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user