Skip to content

Commit 051c5fb

Browse files
committed
Update javadoc
1 parent df09023 commit 051c5fb

File tree

2 files changed

+18
-22
lines changed

2 files changed

+18
-22
lines changed

spring-web/src/main/java/org/springframework/web/accept/ContentNegotiationManagerFactoryBean.java

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -178,20 +178,21 @@ public void setIgnoreAcceptHeader(boolean ignoreAcceptHeader) {
178178
}
179179

180180
/**
181-
* Set the default content type.
182-
* <p>This content type will be used when neither the request path extension,
183-
* nor a request parameter, nor the {@code Accept} header could help
184-
* determine the requested content type.
181+
* Set the default content type to use when no content type was requested.
182+
* <p>Note that internally this method creates and adds a
183+
* {@link org.springframework.web.accept.FixedContentNegotiationStrategy
184+
* FixedContentNegotiationStrategy}. Alternatively you can also provide a
185+
* custom strategy via {@link #setDefaultContentTypeStrategy}.
185186
*/
186187
public void setDefaultContentType(MediaType defaultContentType) {
187188
this.defaultNegotiationStrategy = new FixedContentNegotiationStrategy(defaultContentType);
188189
}
189190

190191
/**
191-
* Set the {@link ContentNegotiationStrategy} to be used to resolving the default content type.
192-
* <p>This content type will be used when neither the request path extension,
193-
* nor a request parameter, nor the {@code Accept} header could help determine
194-
* the requested content type.
192+
* Configure a custom {@link ContentNegotiationStrategy} to use to determine
193+
* the default content type to use when no content type was requested.
194+
* <p>However also consider using {@link #setDefaultContentType} which
195+
* provides a simpler alternative to doing the same.
195196
* @since 4.1.2
196197
*/
197198
public void setDefaultContentTypeStrategy(ContentNegotiationStrategy defaultStrategy) {

spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/ContentNegotiationConfigurer.java

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -158,28 +158,23 @@ public ContentNegotiationConfigurer ignoreAcceptHeader(boolean ignoreAcceptHeade
158158
}
159159

160160
/**
161-
* Set the default content type.
162-
* <p>This content type will be used when neither the request path extension,
163-
* nor a request parameter, nor the {@code Accept} header could help determine
164-
* the requested content type.
165-
* <p>Note that this method achieves the same goal as {@code defaultContentTypeStrategy}, so both
166-
* shouldn't be used at the same time.
167-
* @see #defaultContentTypeStrategy(org.springframework.web.accept.ContentNegotiationStrategy)
161+
* Set the default content type to use when no content type was requested.
162+
* <p>Note that internally this method creates and adds a
163+
* {@link org.springframework.web.accept.FixedContentNegotiationStrategy
164+
* FixedContentNegotiationStrategy}. Alternatively you can also provide a
165+
* custom strategy via {@link #defaultContentTypeStrategy}.
168166
*/
169167
public ContentNegotiationConfigurer defaultContentType(MediaType defaultContentType) {
170168
this.factoryBean.setDefaultContentType(defaultContentType);
171169
return this;
172170
}
173171

174172
/**
175-
* Set the {@link ContentNegotiationStrategy} to be used to resolving the default content type.
176-
* <p>This content type will be used when neither the request path extension,
177-
* nor a request parameter, nor the {@code Accept} header could help determine
178-
* the requested content type.
179-
* <p>Note that this method achieves the same goal as {@code defaultContentType}, so both
180-
* shouldn't be used at the same time.
173+
* Configure a custom {@link ContentNegotiationStrategy} to use to determine
174+
* the default content type to use when no content type was requested.
175+
* <p>However also consider using {@link #defaultContentType} which provides
176+
* a simpler alternative to doing the same.
181177
* @since 4.1.2
182-
* @see #defaultContentType(org.springframework.http.MediaType)
183178
*/
184179
public ContentNegotiationConfigurer defaultContentTypeStrategy(ContentNegotiationStrategy defaultStrategy) {
185180
this.factoryBean.setDefaultContentTypeStrategy(defaultStrategy);

0 commit comments

Comments
 (0)