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 8649997
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T13:42:17+00:00 2026-06-12T13:42:17+00:00

Possible Duplicate: How can I have case insensitive URLS in Spring MVC with annotated

  • 0

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

I have Controller having multiple @RequestMapping annotations in it.

@Controller
public class SignUpController {

 @RequestMapping("signup")
 public String showSignUp() throws Exception {
    return "somejsp";
 }

 @RequestMapping("fullSignup")
 public String showFullSignUp() throws Exception {
    return "anotherjsp";
 }

 @RequestMapping("signup/createAccount")
 public String createAccount() throws Exception {
    return "anyjsp";
 }
}

How can I map these @RequestMapping to case insensitive. i.e. if I use “/fullsignup” or “/fullSignup” I should get “anotherjsp”. But this is not happening right now. Only “/fullSignup” is working fine.

I’ve tried extending RequestMappingHandlerMapping but no success. I’ve also tried AntPathMatcher like the guy mentioned there is another question on this forum but its also not working for @RequestMapping annotation.

Debugging console
enter image description here

Output console when server is up.

enter image description here

I’ve added two images which shows the problem. I’ve tried both the solutions mentioned below. The console says that it mapped lowercased URLS but when I request to access a method with lowercase url then it shows that the original map where the values are stored stilled contained MixCase URLS.

  • 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-06-12T13:42:19+00:00Added an answer on June 12, 2026 at 1:42 pm

    One of the approaches in How can I have case insensitive URLS in Spring MVC with annotated mappings works perfectly. I just tried it with combinations of @RequestMapping at the level of controller and request methods and it has worked cleanly, I am just reproducing it here for Spring 3.1.2:

    The CaseInsensitivePathMatcher:

    import java.util.Map;
    
    import org.springframework.util.AntPathMatcher;
    
    public class CaseInsensitivePathMatcher extends AntPathMatcher {
        @Override
        protected boolean doMatch(String pattern, String path, boolean fullMatch, Map<String, String> uriTemplateVariables) {
            return super.doMatch(pattern.toLowerCase(), path.toLowerCase(), fullMatch, uriTemplateVariables);
        }
    }
    

    Registering this path matcher with Spring MVC, remove the <mvc:annotation-driven/> annotation, and replace with the following, configure appropriately:

    <bean name="handlerAdapter" class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter">
        <property name="webBindingInitializer">
            <bean class="org.springframework.web.bind.support.ConfigurableWebBindingInitializer">
                <property name="conversionService" ref="conversionService"></property>
                <property name="validator">
                    <bean class="org.springframework.validation.beanvalidation.LocalValidatorFactoryBean">
                        <property name="providerClass" value="org.hibernate.validator.HibernateValidator"></property>
                    </bean>
                </property>
            </bean>
        </property>
        <property name="messageConverters">
            <list>
                <ref bean="byteArrayConverter"/>
                <ref bean="jaxbConverter"/>
                <ref bean="jsonConverter"/>
                <bean class="org.springframework.http.converter.StringHttpMessageConverter"></bean>
                <bean class="org.springframework.http.converter.ResourceHttpMessageConverter"></bean>
                <bean class="org.springframework.http.converter.xml.SourceHttpMessageConverter"></bean>
                <bean class="org.springframework.http.converter.xml.XmlAwareFormHttpMessageConverter"></bean>
            </list>
        </property>
    </bean>
    <bean name="byteArrayConverter" class="org.springframework.http.converter.ByteArrayHttpMessageConverter"></bean>
    <bean name="jaxbConverter" class="org.springframework.http.converter.xml.Jaxb2RootElementHttpMessageConverter"></bean>
    <bean name="jsonConverter" class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter"></bean>
    <bean name="caseInsensitivePathMatcher" class="org.bk.lmt.web.spring.CaseInsensitivePathMatcher"/>
    <bean name="handlerMapping" class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping">
        <property name="pathMatcher" ref="caseInsensitivePathMatcher"></property>
    </bean>
    

    Or even more easily and cleanly using @Configuration:

    @Configuration
    @ComponentScan(basePackages="org.bk.webtestuuid")
    public class WebConfiguration extends WebMvcConfigurationSupport{
    
        @Bean
        public PathMatcher pathMatcher(){
            return new CaseInsensitivePathMatcher();
        }
        @Bean
        public RequestMappingHandlerMapping requestMappingHandlerMapping() {
            RequestMappingHandlerMapping handlerMapping = new RequestMappingHandlerMapping();
            handlerMapping.setOrder(0);
            handlerMapping.setInterceptors(getInterceptors());
            handlerMapping.setPathMatcher(pathMatcher());
            return handlerMapping;
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Oracle DB: How can I write query ignoring case? I have an
Possible Duplicate: Can I scroll a ScrollView programmatically in Android? I have a chat
Possible Duplicate: Can Read-Only Properties be Implemented in Pure JavaScript? I have an Object
Possible Duplicate: How can i made a pivot for this I have a table
Possible Duplicate: How can I convert a string to boolean in JavaScript? I have
Possible Duplicate: C++ static virtual members? Can we have a static virtual functions? If
Possible Duplicate: Interfaces: Why can't I seem to grasp them? I have seen many
Possible Duplicate: How can I compare (directory) paths in C#? I have a filename
Possible Duplicate: break in a case with return.. and for default If I have
Possible Duplicate: Caching in asp.net-mvc i have an asp.net-mvc site and i am running

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.