tags:

views:

22

answers:

1

Looks like the default annotations based handler mapping in spring 3.0 does case insensitive handler matching . Is there a way to make this case sensitive ?

A: 

I have not tried this yet... but I think it should work....

<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... */
   }
}
becomputer06