This is similar to this question, but I am still confused about my situation. I want to map this ant-style pattern to a controller method:
/results/**
That is, I want any URL like www.hostname.com/MyServlet/results/123/abc/456/def/
to go to this method. I have:
<servlet-mapping>
<servlet-name>MyServlet</servlet-name>
<url-pattern>/results/*</url-pattern>
</servlet-mapping>
and:
@RequestMapping(value="/**", method=RequestMethod.GET)
public ModelAndView handleRequest() {...}
This works to guide the request to my method, but leads me to several questions:
- What if I add another servlet mapping, like
<url-pattern>/another-mapping/*</url-pattern>
??? It will also get mapped to that method! How can I separate the two? - Why does the url-pattern
/results/*
work, whereas/results/**
doesn't? According to ant path styles,**
means to include nested/
characters, whereas*
stops at the next/
. So, it should only successfully map a URL like/results/123
, bot NOT/results/123/abc/
. Right?