Suppose you have the following method:
@RequestMapping("/post/*/")
public String showPost(Map map) {
}
Now, if I wanted to have pretty urls, such as: /post/welcome-to-the-site/, I could do this by adding HttpServletRequest and doing some regex and pulling this data out myself. However one of the things I love about Spring is it allows me to write code thats REALLY easy to unit test and adding an HttpServletRequest ruins that.
Simply by noticing that there are '*' in the url, it should be possible to have a class such as RequestParts (or even a string array), that tells me that the 1st part is "welcome-to-the-site".
In this manner, the signature could be:
public String showPost(Map map, RequestParts rp) {
if (rp.hasParts()) {
// Load up rp.getPart(0);
}
else {
// Show an archive page
}
}
This would obviously work very well with a String array but might be ambiguous from @RequestParam, which is why a simple class could handle this.