Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

URL Pattern 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 :-

<servlet-mapping>
        <servlet-name>abc</servlet-name>
        <url-pattern>/</url-pattern>
    </servlet-mapping>

Please suggest.

like image 954
saurzcode Avatar asked Jun 04 '12 14:06

saurzcode


1 Answers

You can use the useDefaultSuffixPattern property.

<bean class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping">
    <property name="useDefaultSuffixPattern" value="false" />
</bean>
like image 196
eolith Avatar answered Oct 18 '22 16:10

eolith