コード例 #1
0
 @Test
 public void toUriEncoded() throws URISyntaxException {
   UriComponents uriComponents =
       UriComponentsBuilder.fromUriString("http://example.com/hotel list/Z\u00fcrich").build();
   assertEquals(
       new URI("http://example.com/hotel%20list/Z%C3%BCrich"), uriComponents.encode().toUri());
 }
コード例 #2
0
 @Test
 public void toUriWithIpv6HostAlreadyEncoded() throws URISyntaxException {
   UriComponents uriComponents =
       UriComponentsBuilder.fromUriString(
               "http://[1abc:2abc:3abc::5ABC:6abc]:8080/hotel%20list/Z%C3%BCrich")
           .build(true);
   UriComponents encoded = uriComponents.encode();
   assertEquals(
       new URI("http://[1abc:2abc:3abc::5ABC:6abc]:8080/hotel%20list/Z%C3%BCrich"),
       encoded.toUri());
 }
コード例 #3
0
 @Test
 public void encode() {
   UriComponents uriComponents = UriComponentsBuilder.fromPath("/hotel list").build();
   UriComponents encoded = uriComponents.encode();
   assertEquals("/hotel%20list", encoded.getPath());
 }