SpringMvc framework to address any of the interfaces in Canada RESTFUL ".xxx" permission to bypass the problem

Problem Description:

The framework uses a SpringMVC, SpringSecurity, rights doing interception when found a problem, assuming the request path / user / detail was intercepted authority, when accessing /user/detail.abc was able to have access to

problem causes:

SpringMVC frame will "/user/detail.abc" RequestMapping with the "/ user / detail" regular, the matching rule: /user/detail.*, so when the request comes deposit can /user/detail.abc to / user / detail of the processing performed Controller

Solution:

SpringMVC support path matching rule, RequestMappingHandlerMapping useSuffixPatternMatch class has a property, determining whether the value required by the end of the string. Xml configuration corresponding to

< MVC: Annotation-Driven > 
    < : MVC path-matching suffix-pattern = "false"  <! - if no such configuration, the default is to true -> /> 
  </ MVC: Annotation-Driven >

After this configuration, when you then be accessed through the "/user/detail.abc", it will report a 404 or 405 error, so as to achieve the purpose of intercepting authority

Guess you like

Origin www.cnblogs.com/aligege/p/11544525.html