Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/spring-mvc/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Spring mvc Spring3.0中区分大小写的URL映射_Spring Mvc - Fatal编程技术网

Spring mvc Spring3.0中区分大小写的URL映射

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"/> <

看起来Spring3.0中默认的基于注释的处理程序映射不区分大小写。有没有办法区分大小写?

我还没有试过这个。。。但我认为它应该起作用

<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的实现以获取帮助*/
}
}