Spring mvc Spring3.0中区分大小写的URL映射
看起来Spring3.0中默认的基于注释的处理程序映射不区分大小写。有没有办法区分大小写?我还没有试过这个。。。但我认为它应该起作用Spring mvc Spring3.0中区分大小写的URL映射,spring-mvc,Spring Mvc,看起来Spring3.0中默认的基于注释的处理程序映射不区分大小写。有没有办法区分大小写?我还没有试过这个。。。但我认为它应该起作用 <bean id="handlerAdapter" class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter"> <property name="pathMatcher" ref="myPathMatcher"/> <
<bean id="handlerAdapter" class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter">
<property name="pathMatcher" ref="myPathMatcher"/>
</bean>
<bean id="myPathMatcher" class="org.open.source.MyPathMatcher"/>
public class MyPathMatcher extends org.springframework.util.AntPathMatcher {
@Override
public Comparator<String> getPatternComparator(String path) {
return new MyPathMatcherComparator(path);
}
}
public class MyPathMatcherComparator implements Comparator<String>
{
public int compare(String pattern1, String pattern2) {
/* case sensitive logic goes here, simple return -1, 0, +1*/
/* check implementation of AntPathMatcher$AntPatternComparator for help... */
}
}
公共类MyPathMatcher扩展org.springframework.util.AntPathMatcher{
@凌驾
公共比较器getPatternComparator(字符串路径){
返回新的MyPathMatcherComparator(路径);
}
}
公共类MyPathMatcherComparator实现Comparator
{
公共整数比较(字符串模式1,字符串模式2){
/*区分大小写的逻辑在这里,简单返回-1,0,+1*/
/*检查AntPathMatcher$AntPatternComparator的实现以获取帮助*/
}
}