Skip to content

Commit 6de95a2

Browse files
Graceyu67sbrannen
authored andcommitted
Provide methods for obtaining include/exclude patterns in MappedInterceptor
Prior to this commit, MappedInterceptor had a getPathPatterns() method that returned the include patterns. This commit introduces getIncludePathPatterns() (which effectively replaces getPathPatterns()) and getExcludePathPatterns(). In addition, this commit deprecates getPathPatterns(). Closes gh-30971
1 parent f00756b commit 6de95a2

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

spring-webmvc/src/main/java/org/springframework/web/servlet/handler/MappedInterceptor.java

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,12 +140,33 @@ public MappedInterceptor(@Nullable String[] includePatterns, @Nullable String[]
140140
* Return the patterns this interceptor is mapped to.
141141
*/
142142
@Nullable
143+
@Deprecated
143144
public String[] getPathPatterns() {
144145
return (!ObjectUtils.isEmpty(this.includePatterns) ?
145146
Arrays.stream(this.includePatterns).map(PatternAdapter::getPatternString).toArray(String[]::new) :
146147
null);
147148
}
148149

150+
/**
151+
* Return the include path patterns this interceptor is mapped to.
152+
*/
153+
@Nullable
154+
public String[] getIncludePathPatterns() {
155+
return (!ObjectUtils.isEmpty(this.includePatterns) ?
156+
Arrays.stream(this.includePatterns).map(PatternAdapter::getPatternString).toArray(String[]::new) :
157+
null);
158+
}
159+
160+
/**
161+
* Return the exclude path patterns this interceptor is mapped to.
162+
*/
163+
@Nullable
164+
public String[] getExcludePathPatterns() {
165+
return (!ObjectUtils.isEmpty(this.excludePatterns) ?
166+
Arrays.stream(this.excludePatterns).map(PatternAdapter::getPatternString).toArray(String[]::new) :
167+
null);
168+
}
169+
149170
/**
150171
* The target {@link HandlerInterceptor} to invoke in case of a match.
151172
*/

0 commit comments

Comments
 (0)