-
Notifications
You must be signed in to change notification settings - Fork 38.8k
Description
Daniel Gredler opened SPR-10272 and commented
Spring supports using both "Accept" HTTP headers and extensions (e.g. .xml and .json) for content type negotiation. However, if the client uses extensions, any URLs built using the UriComponentsBuilder will contain the extension.
For example, if the client GETs this book:
and you want the server to return a list of the URLs for each of the pages in the book, e.g.
http://foo.com/rest/books/6/pages/1
then if the client is using extensions for content type negotiation you end up with the following URI:
http://foo.com/rest/books/6.json/pages/1
if you use the standard URI building code:
fromCurrentRequest().path("/pages/{id}").buildAndExpand(pageId).toString()
It should be possible to remove the extension if it's there (or just ignore the removal if there is no extension):
fromCurrentRequest().removeExtension().path("/pages/{id}").buildAndExpand(pageId).toString()
Affects: 3.2 GA
Referenced from: commits 5017855