From 53017da0c369041f5a6c8de64c370f07840341c1 Mon Sep 17 00:00:00 2001 From: Brian Clozel Date: Mon, 3 Mar 2014 12:13:17 +0100 Subject: [PATCH] Update reference documentation for SPR-11486 Issue: SPR-11486 --- src/asciidoc/index.adoc | 53 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/src/asciidoc/index.adoc b/src/asciidoc/index.adoc index 28713c1181..ccbc5c502c 100644 --- a/src/asciidoc/index.adoc +++ b/src/asciidoc/index.adoc @@ -32253,7 +32253,60 @@ Spring JSP tags: ---- +[[mvc-config-path-matching]] +==== Configuring Path Matching +This is a shortcut for configuring `RequestMappingHandlerMapping` path matching properties, without +having to <>. +An example of enabling pattern match features and using custom matchers, in Java: + +[source,java,indent=0] +[subs="verbatim,quotes"] +---- + @Configuration + @EnableWebMvc + public class WebConfig extends WebMvcConfigurerAdapter { + + @Override + public void configurePathMatch(PathMatchConfigurer configurer) { + configurer.setUseSuffixPatternMatch(true) + .setUseTrailingSlashMatch(false) + .setPathMatcher(antPathMatcher()) + .setUrlPathHelper(urlPathHelper()); + } + + @Bean + public UrlPathHelper urlPathHelper() { + //... + } + + @Bean + public PathMatcher antPathMatcher() { + //... + } + + } +---- + +For more details, check out the +{javadoc-baseurl}/org/springframework/web/servlet/config/annotation/PathMatchConfigurer.html[PathMatchConfigurer] API. + +And the same in XML, use the `` element: + +[source,xml,indent=0] +[subs="verbatim,quotes"] +---- + + + + + + +---- [[mvc-default-servlet-handler]] ==== mvc:default-servlet-handler