Results 1 to 3 of 3

Thread: URL Pattern match restricting in Spring MVC

  1. #1

    Post URL Pattern match restricting in Spring MVC

    My Spring Web MVC application has the following handler mapping in the Controller.

    @RequestMapping(method = RequestMethod.GET, value = "/something")

    When request is sent to

    http://www.someURL.com/something

    , it works fine and maps to correct controller but,

    http://www.someURL.com/something.bak

    or

    http://www.someURL.com/something.abc

    or

    http://www.someURL.com/something.abc.deff.xyz

    also works!!

    I want to restrict this to just http://www.someURL.com/something and not to others.

    web.xml defines the mappings as :-
    Code:
    <servlet-mapping>
            <servlet-name>abc</servlet-name>
            <url-pattern>/</url-pattern>
        </servlet-mapping>
    Please suggest.

  2. #2
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,625

    Default

    I suggest a read of the javadocs of the classes you use. Assuming you use Spring 3.1 you should checkout the RequestMappingHandlerMapping configure it and set the useSuffixPatternMatch to false (the default is true).
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

  3. #3

    Default

    Thanks can you please provide some more information as in how to use JavaConfig along with XML config for MVC configuration.



    Quote Originally Posted by Marten Deinum View Post
    I suggest a read of the javadocs of the classes you use. Assuming you use Spring 3.1 you should checkout the RequestMappingHandlerMapping configure it and set the useSuffixPatternMatch to false (the default is true).

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •