So I am having an issue with this URL: http://example.com/something//?filter=something (notice the double trailing slash)
I have a controller set up to handle "/something" as the request mapping, but when there are double trailing slashes, the request mapping goes to "/" instead of "/something".
In my web.xml file, I have a servlet-mapping with the URL pattern of "/".
<servlet-mapping>
<servlet-name>fe</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
In the documentation here: http://docs.spring.io/spring/docs/current/spring-framework-reference/html/mvc.html. I noticed that their example has a url-pattern of "/*" unlike mine "/".
I changed my url-pattern to "/*" and everything works correctly with the only issue being now you can add however many trailing slashes as you want.
What do you think the problem is and do you think changed the url-pattern to "/*" will fix the problem or am I not looking in the right place for the issue? Thanks in advance. :)
Edit: (adding controller per request)
@Controller public class IndexController {
@RequestMapping(
method = RequestMethod.GET,
value = "/"
)
public ModelAndView displayIndex() {
// do things
}
@RequestMapping(
method = RequestMethod.GET,
value = "/something"
)
public ModelAndView displaySomething() {
// do things
}
}