diff --git a/spring-web/src/main/java/org/springframework/web/util/UrlPathHelper.java b/spring-web/src/main/java/org/springframework/web/util/UrlPathHelper.java index bb24d475d6..c1dd2c202a 100644 --- a/spring-web/src/main/java/org/springframework/web/util/UrlPathHelper.java +++ b/spring-web/src/main/java/org/springframework/web/util/UrlPathHelper.java @@ -132,7 +132,6 @@ public class UrlPathHelper { * Whether configured to remove ";" (semicolon) content from the request URI. */ public boolean shouldRemoveSemicolonContent() { - checkReadOnly(); return this.removeSemicolonContent; } diff --git a/spring-web/src/test/java/org/springframework/web/util/UrlPathHelperTests.java b/spring-web/src/test/java/org/springframework/web/util/UrlPathHelperTests.java index a582570b05..ce65e85bad 100644 --- a/spring-web/src/test/java/org/springframework/web/util/UrlPathHelperTests.java +++ b/spring-web/src/test/java/org/springframework/web/util/UrlPathHelperTests.java @@ -24,6 +24,7 @@ import org.junit.jupiter.api.Test; import org.springframework.web.testfixture.servlet.MockHttpServletRequest; import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatCode; /** * Unit tests for {@link UrlPathHelper}. @@ -166,6 +167,11 @@ public class UrlPathHelperTests { assertThat(helper.getLookupPathForRequest(request)).isEqualTo("/welcome.html;c=d"); } + @Test // gh-27303 + public void shouldRemoveSemicolonContentWithReadOnlyInstance() { + assertThatCode(UrlPathHelper.defaultInstance::shouldRemoveSemicolonContent).doesNotThrowAnyException(); + } + // // suite of tests root requests for default servlets (SRV 11.2) on Websphere vs Tomcat and other containers