Merge branch '5.2.x'
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
* Copyright 2002-2020 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.
|
||||
@@ -50,7 +50,7 @@ public class UrlBasedCorsConfigurationSource implements CorsConfigurationSource
|
||||
* @since 5.0.6
|
||||
*/
|
||||
public UrlBasedCorsConfigurationSource() {
|
||||
this(new PathPatternParser());
|
||||
this(PathPatternParser.defaultInstance);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -112,4 +112,35 @@ public class PathPatternParser {
|
||||
return new InternalPathPatternParser(this).parse(pathPattern);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Shared, read-only instance of {@code PathPatternParser}. Uses default settings:
|
||||
* <ul>
|
||||
* <li>{@code matchOptionalTrailingSeparator=true}
|
||||
* <li>{@code caseSensitivetrue}
|
||||
* <li>{@code pathOptions=PathContainer.Options.HTTP_PATH}
|
||||
* </ul>
|
||||
*/
|
||||
public final static PathPatternParser defaultInstance = new PathPatternParser() {
|
||||
|
||||
@Override
|
||||
public void setMatchOptionalTrailingSeparator(boolean matchOptionalTrailingSeparator) {
|
||||
raiseError();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCaseSensitive(boolean caseSensitive) {
|
||||
raiseError();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPathOptions(PathContainer.Options pathOptions) {
|
||||
raiseError();
|
||||
}
|
||||
|
||||
private void raiseError() {
|
||||
throw new UnsupportedOperationException(
|
||||
"This is a read-only, shared instance that cannot be modified");
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user