Skip to content

Commit 93ef169

Browse files
committed
Polishing
1 parent 407bd96 commit 93ef169

File tree

8 files changed

+62
-45
lines changed

8 files changed

+62
-45
lines changed

spring-test/src/main/java/org/springframework/test/web/servlet/ResultMatcher.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2016 the original author or authors.
2+
* Copyright 2002-2018 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -51,7 +51,6 @@ public interface ResultMatcher {
5151

5252
/**
5353
* Assert the result of an executed request.
54-
*
5554
* @param result the result of the executed request
5655
* @throws Exception if a failure occurs
5756
*/

spring-web/src/main/java/org/springframework/http/codec/support/BaseDefaultCodecs.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ List<HttpMessageWriter<?>> getCatchAllWriters() {
233233
}
234234

235235

236-
// Accessors for use in sub-classes...
236+
// Accessors for use in subclasses...
237237

238238
protected Decoder<?> getJackson2JsonDecoder() {
239239
return (this.jackson2JsonDecoder != null ? this.jackson2JsonDecoder : new Jackson2JsonDecoder());

spring-web/src/test/java/org/springframework/http/codec/support/CodecConfigurerTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@
5454
import static org.springframework.core.ResolvableType.forClass;
5555

5656
/**
57-
* Unit tests for {@link BaseCodecConfigurer}.
57+
* Unit tests for {@link BaseDefaultCodecs}.
58+
*
5859
* @author Rossen Stoyanchev
5960
*/
6061
public class CodecConfigurerTests {
@@ -294,7 +295,6 @@ private static class TestCodecConfigurer extends BaseCodecConfigurer {
294295
}
295296

296297
private static class TestDefaultCodecs extends BaseDefaultCodecs {
297-
298298
}
299299
}
300300

spring-webflux/src/main/java/org/springframework/web/reactive/config/WebFluxConfigurationSupport.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,13 +120,14 @@ public RequestMappingHandlerMapping requestMappingHandlerMapping() {
120120

121121
PathMatchConfigurer configurer = getPathMatchConfigurer();
122122
Boolean useTrailingSlashMatch = configurer.isUseTrailingSlashMatch();
123-
Boolean useCaseSensitiveMatch = configurer.isUseCaseSensitiveMatch();
124123
if (useTrailingSlashMatch != null) {
125124
mapping.setUseTrailingSlashMatch(useTrailingSlashMatch);
126125
}
126+
Boolean useCaseSensitiveMatch = configurer.isUseCaseSensitiveMatch();
127127
if (useCaseSensitiveMatch != null) {
128128
mapping.setUseCaseSensitiveMatch(useCaseSensitiveMatch);
129129
}
130+
130131
return mapping;
131132
}
132133

@@ -316,6 +317,10 @@ protected ConfigurableWebBindingInitializer getConfigurableWebBindingInitializer
316317
return initializer;
317318
}
318319

320+
/**
321+
* Return a {@link FormattingConversionService} for use with annotated controllers.
322+
* <p>See {@link #addFormatters} as an alternative to overriding this method.
323+
*/
319324
@Bean
320325
public FormattingConversionService webFluxConversionService() {
321326
FormattingConversionService service = new DefaultFormattingConversionService();
@@ -324,7 +329,9 @@ public FormattingConversionService webFluxConversionService() {
324329
}
325330

326331
/**
327-
* Override to add custom {@link Converter}s and {@link Formatter}s.
332+
* Override this method to add custom {@link Converter} and/or {@link Formatter}
333+
* delegates to the common {@link FormattingConversionService}.
334+
* @see #webFluxConversionService()
328335
*/
329336
protected void addFormatters(FormatterRegistry registry) {
330337
}

spring-webflux/src/main/java/org/springframework/web/reactive/function/server/RequestPredicates.java

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -76,16 +76,18 @@ public static RequestPredicate all() {
7676

7777

7878
/**
79-
* Return a {@code RequestPredicate} that tests against the given HTTP method.
80-
* @param httpMethod the HTTP method to match to
79+
* Return a {@code RequestPredicate} that matches if the request's
80+
* HTTP method is equal to the given method.
81+
* @param httpMethod the HTTP method to match against
8182
* @return a predicate that tests against the given HTTP method
8283
*/
8384
public static RequestPredicate method(HttpMethod httpMethod) {
8485
return new HttpMethodPredicate(httpMethod);
8586
}
8687

8788
/**
88-
* Return a {@code RequestPredicate} that tests the request path against the given path pattern.
89+
* Return a {@code RequestPredicate} that tests the request path
90+
* against the given path pattern.
8991
* @param pattern the pattern to match to
9092
* @return a predicate that tests against the given path pattern
9193
*/
@@ -95,20 +97,22 @@ public static RequestPredicate path(String pattern) {
9597
}
9698

9799
/**
98-
* Return a function that creates new path-matching {@code RequestPredicates} from pattern
99-
* Strings using the given {@link PathPatternParser}. This method can be used to specify a
100-
* non-default, customized {@code PathPatternParser} when resolving path patterns.
100+
* Return a function that creates new path-matching {@code RequestPredicates}
101+
* from pattern Strings using the given {@link PathPatternParser}.
102+
* <p>This method can be used to specify a non-default, customized
103+
* {@code PathPatternParser} when resolving path patterns.
101104
* @param patternParser the parser used to parse patterns given to the returned function
102-
* @return a function that resolves patterns Strings into path-matching
103-
* {@code RequestPredicate}s
105+
* @return a function that resolves a pattern String into a path-matching
106+
* {@code RequestPredicates} instance
104107
*/
105108
public static Function<String, RequestPredicate> pathPredicates(PathPatternParser patternParser) {
106-
Assert.notNull(patternParser, "'patternParser' must not be null");
109+
Assert.notNull(patternParser, "PathPatternParser must not be null");
107110
return pattern -> new PathPatternPredicate(patternParser.parse(pattern));
108111
}
109112

110113
/**
111-
* Return a {@code RequestPredicate} that tests the request's headers against the given headers predicate.
114+
* Return a {@code RequestPredicate} that tests the request's headers
115+
* against the given headers predicate.
112116
* @param headersPredicate a predicate that tests against the request headers
113117
* @return a predicate that tests against the given header predicate
114118
*/
@@ -290,20 +294,19 @@ public static RequestPredicate pathExtension(Predicate<String> extensionPredicat
290294

291295
/**
292296
* Return a {@code RequestPredicate} that matches if the request's query parameter of the given name
293-
* has the given value
297+
* has the given value.
294298
* @param name the name of the query parameter to test against
295299
* @param value the value of the query parameter to test against
296300
* @return a predicate that matches if the query parameter has the given value
297-
* @see ServerRequest#queryParam(String)
298301
* @since 5.0.7
302+
* @see ServerRequest#queryParam(String)
299303
*/
300304
public static RequestPredicate queryParam(String name, String value) {
301305
return queryParam(name, new Predicate<String>() {
302306
@Override
303307
public boolean test(String s) {
304308
return s.equals(value);
305309
}
306-
307310
@Override
308311
public String toString() {
309312
return String.format("== %s", value);
@@ -326,9 +329,8 @@ public static RequestPredicate queryParam(String name, Predicate<String> predica
326329

327330
private static void traceMatch(String prefix, Object desired, @Nullable Object actual, boolean match) {
328331
if (logger.isTraceEnabled()) {
329-
String message = String.format("%s \"%s\" %s against value \"%s\"",
330-
prefix, desired, match ? "matches" : "does not match", actual);
331-
logger.trace(message);
332+
logger.trace(String.format("%s \"%s\" %s against value \"%s\"",
333+
prefix, desired, match ? "matches" : "does not match", actual));
332334
}
333335
}
334336

@@ -472,6 +474,10 @@ public String toString() {
472474
}
473475

474476

477+
/**
478+
* {@link RequestPredicate} for where both {@code left} and {@code right} predicates
479+
* must match.
480+
*/
475481
static class AndRequestPredicate implements RequestPredicate {
476482

477483
private final RequestPredicate left;
@@ -502,6 +508,10 @@ public String toString() {
502508
}
503509

504510

511+
/**
512+
* {@link RequestPredicate} for where either {@code left} or {@code right} predicates
513+
* may match.
514+
*/
505515
static class OrRequestPredicate implements RequestPredicate {
506516

507517
private final RequestPredicate left;

spring-webflux/src/main/java/org/springframework/web/reactive/result/method/annotation/RequestMappingHandlerMapping.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2017 the original author or authors.
2+
* Copyright 2002-2018 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -57,14 +57,21 @@ public class RequestMappingHandlerMapping extends RequestMappingInfoHandlerMappi
5757

5858

5959
/**
60-
* Set the {@link RequestedContentTypeResolver} to use to determine requested media types.
61-
* If not set, the default constructor is used.
60+
* Set the {@link RequestedContentTypeResolver} to use to determine requested
61+
* media types. If not set, the default constructor is used.
6262
*/
6363
public void setContentTypeResolver(RequestedContentTypeResolver contentTypeResolver) {
6464
Assert.notNull(contentTypeResolver, "'contentTypeResolver' must not be null");
6565
this.contentTypeResolver = contentTypeResolver;
6666
}
6767

68+
/**
69+
* Return the configured {@link RequestedContentTypeResolver}.
70+
*/
71+
public RequestedContentTypeResolver getContentTypeResolver() {
72+
return this.contentTypeResolver;
73+
}
74+
6875
@Override
6976
public void setEmbeddedValueResolver(StringValueResolver resolver) {
7077
this.embeddedValueResolver = resolver;
@@ -80,13 +87,6 @@ public void afterPropertiesSet() {
8087
}
8188

8289

83-
/**
84-
* Return the configured {@link RequestedContentTypeResolver}.
85-
*/
86-
public RequestedContentTypeResolver getContentTypeResolver() {
87-
return this.contentTypeResolver;
88-
}
89-
9090
/**
9191
* {@inheritDoc}
9292
* Expects a handler to have a type-level @{@link Controller} annotation.

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -624,9 +624,8 @@ protected void configureAsyncSupport(AsyncSupportConfigurer configurer) {
624624
}
625625

626626
/**
627-
* Return a {@link FormattingConversionService} for use with annotated
628-
* controller methods and the {@code spring:eval} JSP tag.
629-
* Also see {@link #addFormatters} as an alternative to overriding this method.
627+
* Return a {@link FormattingConversionService} for use with annotated controllers.
628+
* <p>See {@link #addFormatters} as an alternative to overriding this method.
630629
*/
631630
@Bean
632631
public FormattingConversionService mvcConversionService() {
@@ -636,7 +635,9 @@ public FormattingConversionService mvcConversionService() {
636635
}
637636

638637
/**
639-
* Override this method to add custom {@link Converter}s and {@link Formatter}s.
638+
* Override this method to add custom {@link Converter} and/or {@link Formatter}
639+
* delegates to the common {@link FormattingConversionService}.
640+
* @see #mvcConversionService()
640641
*/
641642
protected void addFormatters(FormatterRegistry registry) {
642643
}

spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/RequestMappingHandlerMapping.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2017 the original author or authors.
2+
* Copyright 2002-2018 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -111,6 +111,13 @@ public void setContentNegotiationManager(ContentNegotiationManager contentNegoti
111111
this.contentNegotiationManager = contentNegotiationManager;
112112
}
113113

114+
/**
115+
* Return the configured {@link ContentNegotiationManager}.
116+
*/
117+
public ContentNegotiationManager getContentNegotiationManager() {
118+
return this.contentNegotiationManager;
119+
}
120+
114121
@Override
115122
public void setEmbeddedValueResolver(StringValueResolver resolver) {
116123
this.embeddedValueResolver = resolver;
@@ -151,13 +158,6 @@ public boolean useTrailingSlashMatch() {
151158
return this.useTrailingSlashMatch;
152159
}
153160

154-
/**
155-
* Return the configured {@link ContentNegotiationManager}.
156-
*/
157-
public ContentNegotiationManager getContentNegotiationManager() {
158-
return this.contentNegotiationManager;
159-
}
160-
161161
/**
162162
* Return the file extensions to use for suffix pattern matching.
163163
*/

0 commit comments

Comments
 (0)