Add fromHttpRequest to UriComponentsBuilder

Before this change, detection of X-Forwarded-* headers was only built
into ServletUriComponentsBuilder.

This change adds a new method for creating a UriComponentsBuilder from
an existing HttpRequest. This is equivalent to the fromUri method +
X-Forwarded-* header values.
This commit is contained in:
Rossen Stoyanchev
2015-02-10 06:49:25 +01:00
parent 9b3319b3b3
commit f84c458aba
4 changed files with 86 additions and 32 deletions

View File

@@ -41,7 +41,7 @@ public class ServletUriComponentsBuilderTests {
this.request = new MockHttpServletRequest();
this.request.setScheme("http");
this.request.setServerName("localhost");
this.request.setServerPort(80);
this.request.setServerPort(-1);
this.request.setContextPath("/mvc-showcase");
}