@ -1,5 +1,5 @@
@@ -1,5 +1,5 @@
/ *
* Copyright 2002 - 2015 the original author or authors .
* Copyright 2002 - 2019 the original author or authors .
*
* Licensed under the Apache License , Version 2 . 0 ( the "License" ) ;
* you may not use this file except in compliance with the License .
@ -49,8 +49,8 @@ public class UriComponentsBuilderTests {
@@ -49,8 +49,8 @@ public class UriComponentsBuilderTests {
@Test
public void plain ( ) throws URISyntaxException {
UriComponentsBuilder builder = UriComponentsBuilder . newInstance ( ) ;
UriComponents result = builder . scheme ( "http" ) . host ( "example.com" ) . path ( "foo" ) . queryParam ( "bar" ) . fragment ( "baz" ) . build ( ) ;
assertEquals ( "http" , result . getScheme ( ) ) ;
UriComponents result = builder . scheme ( "https " ) . host ( "example.com" ) . path ( "foo" ) . queryParam ( "bar" ) . fragment ( "baz" ) . build ( ) ;
assertEquals ( "https " , result . getScheme ( ) ) ;
assertEquals ( "example.com" , result . getHost ( ) ) ;
assertEquals ( "foo" , result . getPath ( ) ) ;
assertEquals ( "bar" , result . getQuery ( ) ) ;
@ -62,18 +62,18 @@ public class UriComponentsBuilderTests {
@@ -62,18 +62,18 @@ public class UriComponentsBuilderTests {
@Test
public void multipleFromSameBuilder ( ) throws URISyntaxException {
UriComponentsBuilder builder = UriComponentsBuilder . newInstance ( ) . scheme ( "http" ) . host ( "example.com" ) . pathSegment ( "foo" ) ;
UriComponentsBuilder builder = UriComponentsBuilder . newInstance ( ) . scheme ( "https " ) . host ( "example.com" ) . pathSegment ( "foo" ) ;
UriComponents result1 = builder . build ( ) ;
builder = builder . pathSegment ( "foo2" ) . queryParam ( "bar" ) . fragment ( "baz" ) ;
UriComponents result2 = builder . build ( ) ;
assertEquals ( "http" , result1 . getScheme ( ) ) ;
assertEquals ( "https " , result1 . getScheme ( ) ) ;
assertEquals ( "example.com" , result1 . getHost ( ) ) ;
assertEquals ( "/foo" , result1 . getPath ( ) ) ;
URI expected = new URI ( "https://example.com/foo" ) ;
assertEquals ( "Invalid result URI" , expected , result1 . toUri ( ) ) ;
assertEquals ( "http" , result2 . getScheme ( ) ) ;
assertEquals ( "https " , result2 . getScheme ( ) ) ;
assertEquals ( "example.com" , result2 . getHost ( ) ) ;
assertEquals ( "/foo/foo2" , result2 . getPath ( ) ) ;
assertEquals ( "bar" , result2 . getQuery ( ) ) ;
@ -105,7 +105,7 @@ public class UriComponentsBuilderTests {
@@ -105,7 +105,7 @@ public class UriComponentsBuilderTests {
public void fromHierarchicalUri ( ) throws URISyntaxException {
URI uri = new URI ( "https://example.com/foo?bar#baz" ) ;
UriComponents result = UriComponentsBuilder . fromUri ( uri ) . build ( ) ;
assertEquals ( "http" , result . getScheme ( ) ) ;
assertEquals ( "https " , result . getScheme ( ) ) ;
assertEquals ( "example.com" , result . getHost ( ) ) ;
assertEquals ( "/foo" , result . getPath ( ) ) ;
assertEquals ( "bar" , result . getQuery ( ) ) ;
@ -137,7 +137,7 @@ public class UriComponentsBuilderTests {
@@ -137,7 +137,7 @@ public class UriComponentsBuilderTests {
@Test
public void fromUriString ( ) {
UriComponents result = UriComponentsBuilder . fromUriString ( "https://www.ietf.org/rfc/rfc3986.txt" ) . build ( ) ;
assertEquals ( "http" , result . getScheme ( ) ) ;
assertEquals ( "https " , result . getScheme ( ) ) ;
assertNull ( result . getUserInfo ( ) ) ;
assertEquals ( "www.ietf.org" , result . getHost ( ) ) ;
assertEquals ( - 1 , result . getPort ( ) ) ;
@ -149,7 +149,7 @@ public class UriComponentsBuilderTests {
@@ -149,7 +149,7 @@ public class UriComponentsBuilderTests {
result = UriComponentsBuilder . fromUriString (
"https://arjen:foobar@java.sun.com:80/javase/6/docs/api/java/util/BitSet.html?foo=bar#and(java.util.BitSet)" )
. build ( ) ;
assertEquals ( "http" , result . getScheme ( ) ) ;
assertEquals ( "https " , result . getScheme ( ) ) ;
assertEquals ( "arjen:foobar" , result . getUserInfo ( ) ) ;
assertEquals ( "java.sun.com" , result . getHost ( ) ) ;
assertEquals ( 80 , result . getPort ( ) ) ;
@ -266,7 +266,7 @@ public class UriComponentsBuilderTests {
@@ -266,7 +266,7 @@ public class UriComponentsBuilderTests {
@Test //SPR-14761
public void fromHttpRequestWithForwardedIPv4Host ( ) {
MockHttpServletRequest request = new MockHttpServletRequest ( ) ;
request . setScheme ( "http" ) ;
request . setScheme ( "https " ) ;
request . setServerName ( "localhost" ) ;
request . setServerPort ( - 1 ) ;
request . setRequestURI ( "/mvc-showcase" ) ;
@ -275,7 +275,7 @@ public class UriComponentsBuilderTests {
@@ -275,7 +275,7 @@ public class UriComponentsBuilderTests {
HttpRequest httpRequest = new ServletServerHttpRequest ( request ) ;
UriComponents result = UriComponentsBuilder . fromHttpRequest ( httpRequest ) . build ( ) ;
assertEquals ( "http://192.168.0.1/mvc-showcase" , result . toString ( ) ) ;
assertEquals ( "https ://192.168.0.1/mvc-showcase" , result . toString ( ) ) ;
}
@Test //SPR-14761
@ -449,7 +449,7 @@ public class UriComponentsBuilderTests {
@@ -449,7 +449,7 @@ public class UriComponentsBuilderTests {
HttpRequest httpRequest = new ServletServerHttpRequest ( request ) ;
UriComponents result = UriComponentsBuilder . fromHttpRequest ( httpRequest ) . build ( ) ;
assertEquals ( "https ://a.example.org/mvc-showcase" , result . toString ( ) ) ;
assertEquals ( "http://a.example.org/mvc-showcase" , result . toString ( ) ) ;
}
@Test // SPR-12816