diff --git a/spring-web/src/main/java/org/springframework/web/accept/ContentNegotiationManagerFactoryBean.java b/spring-web/src/main/java/org/springframework/web/accept/ContentNegotiationManagerFactoryBean.java index fe00ab162ad9cacaa699675ee7f07253a9cc9842..f49cff6395279ec646ac075b64974dbda15d55b5 100644 --- a/spring-web/src/main/java/org/springframework/web/accept/ContentNegotiationManagerFactoryBean.java +++ b/spring-web/src/main/java/org/springframework/web/accept/ContentNegotiationManagerFactoryBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2018 the original author or authors. + * Copyright 2002-2019 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. @@ -36,49 +36,55 @@ import org.springframework.web.context.ServletContextAware; /** * Factory to create a {@code ContentNegotiationManager} and configure it with - * one or more {@link ContentNegotiationStrategy} instances. + * {@link ContentNegotiationStrategy} instances. * - *

As of 5.0 you can set the exact strategies to use via - * {@link #setStrategies(List)}. - * - *

As an alternative you can also rely on the set of defaults described below - * which can be turned on or off or customized through the methods of this - * builder: + *

This factory offers properties that in turn result in configuring the + * underlying strategies. The table below shows the property names, their + * default settings, as well as the strategies that they help to configure: * * * * + * * - * + * * * - * - * - * + * + * + * + * * * * - * + * + * * * * * - * - * + * + * + * * * * - * - * + * + * + * * * * + * * - * + * * *
Property SetterDefault ValueUnderlying StrategyDefault SettingEnabled Or Not
{@link #setFavorPathExtension}{@link PathExtensionContentNegotiationStrategy Path Extension strategy}On{@link #setFavorPathExtension favorPathExtension}true{@link PathExtensionContentNegotiationStrategy}Enabled
{@link #setFavorParameter favorParameter}{@link ParameterContentNegotiationStrategy Parameter strategy}false{@link ParameterContentNegotiationStrategy}Off
{@link #setIgnoreAcceptHeader ignoreAcceptHeader}{@link HeaderContentNegotiationStrategy Header strategy}Onfalse{@link HeaderContentNegotiationStrategy}Enabled
{@link #setDefaultContentType defaultContentType}{@link FixedContentNegotiationStrategy Fixed content strategy}Not setnull{@link FixedContentNegotiationStrategy}Off
{@link #setDefaultContentTypeStrategy defaultContentTypeStrategy}null{@link ContentNegotiationStrategy}Not setOff
* - * Note: if you must use URL-based content type resolution, + *

As of 5.0 you can set the exact strategies to use via + * {@link #setStrategies(List)}. + * + *

Note: if you must use URL-based content type resolution, * the use of a query parameter is simpler and preferable to the use of a path * extension since the latter can cause issues with URI variables, path * parameters, and URI decoding. Consider setting {@link #setFavorPathExtension} diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/ContentNegotiationConfigurer.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/ContentNegotiationConfigurer.java index 58b100acaaf297f53b8babb02ed933d8d42d7196..6b0c2522ea582afd63bebce855dba565c0b4b6a6 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/ContentNegotiationConfigurer.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/ContentNegotiationConfigurer.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2018 the original author or authors. + * Copyright 2002-2019 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. @@ -38,50 +38,53 @@ import org.springframework.web.accept.PathExtensionContentNegotiationStrategy; * Creates a {@code ContentNegotiationManager} and configures it with * one or more {@link ContentNegotiationStrategy} instances. * - *

As of 5.0 you can set the exact strategies to use via - * {@link #strategies(List)}. - * - *

As an alternative you can also rely on the set of defaults described below - * which can be turned on or off or customized through the methods of this - * builder: + *

This factory offers properties that in turn result in configuring the + * underlying strategies. The table below shows the property names, their + * default settings, as well as the strategies that they help to configure: * * * - * + * + * * - * + * * * * - * - * + * + * + * * * * - * + * + * * * * * - * - * + * + * + * * * * - * - * + * + * + * * * * + * * - * + * * *
Configurer PropertyProperty SetterDefault ValueUnderlying StrategyDefault SettingEnabled Or Not
{@link #favorPathExtension}{@link PathExtensionContentNegotiationStrategy Path Extension strategy}Ontrue{@link PathExtensionContentNegotiationStrategy}Enabled
{@link #favorParameter}{@link ParameterContentNegotiationStrategy Parameter strategy}false{@link ParameterContentNegotiationStrategy}Off
{@link #ignoreAcceptHeader}{@link HeaderContentNegotiationStrategy Header strategy}Onfalse{@link HeaderContentNegotiationStrategy}Enabled
{@link #defaultContentType}{@link FixedContentNegotiationStrategy Fixed content strategy}Not setnull{@link FixedContentNegotiationStrategy}Off
{@link #defaultContentTypeStrategy}null{@link ContentNegotiationStrategy}Not setOff
* - *

The order in which strategies are configured is fixed. You can only turn - * them on or off. + *

As of 5.0 you can set the exact strategies to use via + * {@link #strategies(List)}. * - * Note: if you must use URL-based content type resolution, + *

Note: if you must use URL-based content type resolution, * the use of a query parameter is simpler and preferable to the use of a path * extension since the latter can cause issues with URI variables, path * parameters, and URI decoding. Consider setting {@link #favorPathExtension}