From 61d6fbc2a91a59fc777c8e7884a73b149a61e3f9 Mon Sep 17 00:00:00 2001 From: Josh Cummings <3627351+jzheaux@users.noreply.github.com> Date: Tue, 22 Apr 2025 14:44:01 -0600 Subject: [PATCH] Update Documentation for PathPatternRequestMatcher Issue gh-16765 --- docs/modules/ROOT/pages/migration-7/web.adoc | 6 +++--- .../servlet/authorization/authorize-http-requests.adoc | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/modules/ROOT/pages/migration-7/web.adoc b/docs/modules/ROOT/pages/migration-7/web.adoc index 330d87ddc2..467f2663e8 100644 --- a/docs/modules/ROOT/pages/migration-7/web.adoc +++ b/docs/modules/ROOT/pages/migration-7/web.adoc @@ -401,7 +401,7 @@ Instead of taking this responsibility away from developers, now it is simpler to [method,java] ---- -PathPatternRequestParser.Builder servlet = PathPatternRequestParser.servletPath("/mvc"); +PathPatternRequestParser.Builder servlet = PathPatternRequestParser.withDefaults().basePath("/mvc"); http .authorizeHttpRequests((authorize) -> authorize .requestMatchers(servlet.pattern("/orders/**").matcher()).authenticated() @@ -409,11 +409,11 @@ http ---- -For paths that belong to the default servlet, use `PathPatternRequestParser.path()` instead: +For paths that belong to the default servlet, use `PathPatternRequestParser.withDefaults()` instead: [method,java] ---- -PathPatternRequestParser.Builder request = PathPatternRequestParser.path(); +PathPatternRequestParser.Builder request = PathPatternRequestParser.withDefaults(); http .authorizeHttpRequests((authorize) -> authorize .requestMatchers(request.pattern("/js/**").matcher()).authenticated() diff --git a/docs/modules/ROOT/pages/servlet/authorization/authorize-http-requests.adoc b/docs/modules/ROOT/pages/servlet/authorization/authorize-http-requests.adoc index 584c85da47..ca3fd6b2bf 100644 --- a/docs/modules/ROOT/pages/servlet/authorization/authorize-http-requests.adoc +++ b/docs/modules/ROOT/pages/servlet/authorization/authorize-http-requests.adoc @@ -594,7 +594,7 @@ import static org.springframework.security.web.servlet.util.matcher.PathPatternR @Bean SecurityFilterChain appEndpoints(HttpSecurity http) { - PathPatternRequestMatcher.Builder mvc = withDefaults().servletPath("/spring-mvc"); + PathPatternRequestMatcher.Builder mvc = withDefaults().basePath("/spring-mvc"); http .authorizeHttpRequests((authorize) -> authorize .requestMatchers(mvc.matcher("/admin/**")).hasAuthority("admin")