Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6557717
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T13:06:37+00:00 2026-05-25T13:06:37+00:00

I have looked for the answer to this on Google and stackoverflow, but unfortunately

  • 0

I have looked for the answer to this on Google and stackoverflow, but unfortunately the solutions provided either assume a lot of prior knowelege about Spring MVC and Java or are about case insensitivity with annotations.

Because of this I am not sure how to adapt these solutions to my own problem, hence the reason for this new question about it.

What I want to do sounds simple.
I have a dispatcher-servlet.xml file with the following block of XML in it:

<bean id="urlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
        <property name="mappings">
            <props>
                <prop key="*.htm">pageController</prop>
                <prop key="*.html">pageController</prop>
                <prop key="/cms/*">pageController</prop>
                <prop key="/admin/*">adminController</prop>
            </props>
        </property>
    </bean>

I want the /cms/* and /admin/* keys to be case insensitive, but being new to both Java and Spring MVC, I don’t understand how I should go about doing this.

For example, even if someone types /CMS/ or /Cms/ I want it to use the pageController whereas at the moment it will just display a 404 page.

Would anyone be able to explain to me exactly what I would have to do to achieve my desired result?

Any help would be greatly appreciated!

Edit:

As per Rupok’s answer I have added a class to extend AntPathMatcher.

Unfortunately being new to this I do not know how to “set this back on the SimpleUrlHandlerMapping”.

Would anybody be able to point me in the right direction?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T13:06:38+00:00Added an answer on May 25, 2026 at 1:06 pm

    The default matching mechanism for the SimpleUrlHandlerMapping is an AntPathMatcher. You could either create your own PathMatcher implementation or subclass the AntPathMatcher and set this back on the SimpleUrlHandlerMapping.

    The PathMatcher interface is fairly straight forward to implement.

    public class CaseInsensitiveAntPathMatcher extends AntPathMatcher {
    
      @Override
      public boolean match(String pattern, String string) {
        return super.match(pattern.toLowerCase(), string.toLowerCase()); // make this according to your need
      }
    }
    

    In the configuration it looks like this:

    <bean id="urlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
    <property name="mappings">
        <props>
            <prop key=".htm">pageController</prop>
            <prop key=".html">pageController</prop>
            <prop key="/cms/*">pageController</prop>
            <prop key="/admin/*">adminController</prop>
        </props>
    </property>
    <property name="pathMatcher">
        <bean class="packagename.CaseInsensitiveAntPathMatcher"/>
    </property>
    <property name="alwaysUseFullPath" value="true"/>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Preface: I have looked all over stackoverflow.com and google for this. I have found
I have looked around on the Internet trying to answer this question. It seems
I have looked a lot on google for answers of how to use the
I've looked around (here at stackoverflow and with Google) but I can't seem to
I have looked through the answers in this forum but cannot seem to find
I've found this question many times on Google and on StackOverflow, though none answer
I have looked all of the place for this and I can't seem to
I have looked at the Suggested related questions but none of them are what
I have some accesses from 192.168.0.71 on my apache logs. I looked up this
I looked for the answer but didn't find one - my question(s) follow: I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.