Polish contribution

See gh-30971
This commit is contained in:
Sam Brannen
2023-08-01 16:05:59 +03:00
parent 6de95a2b37
commit f9f7a7cd78
2 changed files with 16 additions and 11 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2023 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.
@@ -514,8 +514,8 @@ public class StandaloneMockMvcBuilder extends AbstractMockMvcBuilder<StandaloneM
protected void addInterceptors(InterceptorRegistry registry) {
for (MappedInterceptor interceptor : mappedInterceptors) {
InterceptorRegistration registration = registry.addInterceptor(interceptor.getInterceptor());
if (interceptor.getPathPatterns() != null) {
registration.addPathPatterns(interceptor.getPathPatterns());
if (interceptor.getIncludePathPatterns() != null) {
registration.addPathPatterns(interceptor.getIncludePathPatterns());
}
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2021 the original author or authors.
* Copyright 2002-2023 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.
@@ -137,18 +137,21 @@ public final class MappedInterceptor implements HandlerInterceptor {
/**
* Return the patterns this interceptor is mapped to.
* Get the include path patterns this interceptor is mapped to.
* @see #getIncludePathPatterns()
* @see #getExcludePathPatterns()
* @deprecated since 6.1 in favor of {@link #getIncludePathPatterns()}
*/
@Nullable
@Deprecated
@Deprecated(since = "6.1", forRemoval = true)
public String[] getPathPatterns() {
return (!ObjectUtils.isEmpty(this.includePatterns) ?
Arrays.stream(this.includePatterns).map(PatternAdapter::getPatternString).toArray(String[]::new) :
null);
return getIncludePathPatterns();
}
/**
* Return the include path patterns this interceptor is mapped to.
* Get the include path patterns this interceptor is mapped to.
* @since 6.1
* @see #getExcludePathPatterns()
*/
@Nullable
public String[] getIncludePathPatterns() {
@@ -158,7 +161,9 @@ public final class MappedInterceptor implements HandlerInterceptor {
}
/**
* Return the exclude path patterns this interceptor is mapped to.
* Get the exclude path patterns this interceptor is mapped to.
* @since 6.1
* @see #getIncludePathPatterns()
*/
@Nullable
public String[] getExcludePathPatterns() {