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 575f822f957f..663dbb7566c4 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 @@ -147,7 +147,6 @@ public void setRemoveSemicolonContent(boolean removeSemicolonContent) { * 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 0aea5a0b51d9..1b2921205f51 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 @@ -22,6 +22,7 @@ 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}. @@ -165,6 +166,11 @@ public void getLookupPathWithSemicolonContentAndNullPathInfo() { 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