Lets say I have the following two REST endpoints built with Spring MVC (v.4):
1. [GET] /cars/make/{make}
2. [GET] /cars/make/{make}/model
And the following requests:
1. curl -X GET -H "Accept: application/json" "http://localhost/cars/make//model"
2. curl -X GET -H "Accept: application/json" "http://localhost/cars/make/%20/model"
The two requests will match the first endpoint (with path variable make
having a value of model
. Is it possible to change the matcher to match on the second endpoint with make
being an empty string or whitespace?
I've been able to override the default Spring AntPathMatcher
to not trim tokens, thus fixing the issue with the second request. However I'm not sure how to modify it so that it strictly respects the 2 backslashes with no whitespace in between. Is this possible?