In DefaultLinkGenerator line 258 and forward, the generation of relative urls is handled. In line 261 there's an if statement, that checks if you have provided a base url or if a context path is either provided or present. If either is the case, absolute urls are forced.
In my present project, the application is in the root of the web container and I have not provided a base url. As such, I can not create relative urls for my application.
I understand that if you provide a base url, that this is in contradiction to the absolute flag of the link generator and as such it overrides the absolute flag. However, I can not figure out why absolute urls are forced if there is no context path for the application.
Can anyone enlighten me?
So far, we have simply resorted to generating the url and then removing the host part of the generated url. Ugly, but it gets the job done.