Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I have case insensitive URLS in Spring MVC with annotated mappings

I have annotated mappings working great through my spring mvc web app, however, they are case sensitive. I cannot find a way to make them case insensitive. (I'd love to make this happen within Spring MVC, rather than redirecting traffic somehow)

like image 486
Dave Avatar asked Nov 10 '10 23:11

Dave


1 Answers

Spring 4.2 will support case-insensitive path matching. You can configure it as follows:

@Configuration public class WebConfig extends WebMvcConfigurerAdapter {     @Override     public void configurePathMatch(PathMatchConfigurer configurer) {         AntPathMatcher matcher = new AntPathMatcher();         matcher.setCaseSensitive(false);         configurer.setPathMatcher(matcher);     } } 
like image 97
npcode Avatar answered Oct 16 '22 18:10

npcode