Update to new location of management context path property.
This commit is contained in:
@@ -68,21 +68,20 @@ public class TraceWebAutoConfiguration {
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets or appends {@link ManagementServerProperties#getContextPath()} to the skip
|
||||
* Sets or appends {@link ManagementServerProperties.Servlet#getContextPath()} to the skip
|
||||
* pattern. If neither is available then sets the default one
|
||||
*/
|
||||
static Pattern getPatternForManagementServerProperties(
|
||||
ManagementServerProperties managementServerProperties,
|
||||
SleuthWebProperties sleuthWebProperties) {
|
||||
String skipPattern = sleuthWebProperties.getSkipPattern();
|
||||
if (StringUtils.hasText(skipPattern)
|
||||
&& StringUtils.hasText(managementServerProperties.getContextPath())) {
|
||||
return Pattern.compile(skipPattern + "|"
|
||||
+ managementServerProperties.getContextPath() + ".*");
|
||||
String contextPath = managementServerProperties.getServlet().getContextPath();
|
||||
|
||||
if (StringUtils.hasText(skipPattern) && StringUtils.hasText(contextPath)) {
|
||||
return Pattern.compile(skipPattern + "|" + contextPath + ".*");
|
||||
}
|
||||
else if (StringUtils.hasText(managementServerProperties.getContextPath())) {
|
||||
return Pattern
|
||||
.compile(managementServerProperties.getContextPath() + ".*");
|
||||
else if (StringUtils.hasText(contextPath)) {
|
||||
return Pattern.compile(contextPath + ".*");
|
||||
}
|
||||
return defaultSkipPattern(skipPattern);
|
||||
}
|
||||
|
||||
@@ -64,20 +64,18 @@ public class SkipPatternProviderConfigTest {
|
||||
SleuthWebProperties sleuthWebProperties = new SleuthWebProperties();
|
||||
sleuthWebProperties.setSkipPattern("");
|
||||
|
||||
ManagementServerProperties properties = new ManagementServerProperties();
|
||||
properties.getServlet().setContextPath("");
|
||||
|
||||
Pattern pattern = TraceWebAutoConfiguration.SkipPatternProviderConfig.getPatternForManagementServerProperties(
|
||||
new ManagementServerProperties() {
|
||||
@Override
|
||||
public String getContextPath() {
|
||||
return "";
|
||||
}
|
||||
}, sleuthWebProperties);
|
||||
properties, sleuthWebProperties);
|
||||
|
||||
then(pattern.pattern()).isEqualTo(SleuthWebProperties.DEFAULT_SKIP_PATTERN);
|
||||
}
|
||||
|
||||
private ManagementServerProperties managementServerPropertiesWithContextPath() {
|
||||
ManagementServerProperties managementServerProperties = new ManagementServerProperties();
|
||||
managementServerProperties.setContextPath("/management/context");
|
||||
managementServerProperties.getServlet().setContextPath("/management/context");
|
||||
return managementServerProperties;
|
||||
}
|
||||
}
|
||||
@@ -289,7 +289,7 @@ public class TraceFilterIntegrationTests extends AbstractMvcIntegrationTest {
|
||||
@Primary
|
||||
ManagementServerProperties managementServerProperties() {
|
||||
ManagementServerProperties managementServerProperties = new ManagementServerProperties();
|
||||
managementServerProperties.setContextPath("/additionalContextPath");
|
||||
managementServerProperties.getServlet().setContextPath("/additionalContextPath");
|
||||
return managementServerProperties;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user