Package javax.ws.rs.core

Examples of javax.ws.rs.core.UriBuilder.host()


    }

    public void testBuildMethods() {
        UriBuilder builder = new UriBuilderImpl();
        String[] segments = new String[] {"some", "{v1}", "path{v2}", "{v3}", "a+b{v4}"};
        builder.host("localhost").port(8080).segment(segments).fragment("{v5}");

        // build
        URI uri = builder.build("path", "Ex", "a#b", "c%2Bd", "frag");
        String uriString = uri.toString();
        assertEquals("//localhost:8080/some/path/pathEx/a%23b/a+bc%252Bd#frag", uriString);
View Full Code Here


    }

    public void testBuildMethods() {
        UriBuilder builder = new UriBuilderImpl();
        String[] segments = new String[] {"some", "{v1}", "path{v2}", "{v3}", "a+b{v4}"};
        builder.host("localhost").port(8080).segment(segments).fragment("{v5}");

        // build
        URI uri = builder.build("path", "Ex", "a#b", "c%2Bd", "frag");
        String uriString = uri.toString();
        assertEquals("//localhost:8080/some/path/pathEx/a%23b/a+bc%252Bd#frag", uriString);
View Full Code Here

        assertEquals("", uriBuilder.build().toString());
    }

    public void testNullHost() {
        UriBuilder uriBuilder = UriBuilder.fromPath("/path");
        uriBuilder = uriBuilder.host("localhost");
        assertEquals("//localhost/path", uriBuilder.build().toString());

        uriBuilder = uriBuilder.host(null);
        assertEquals("/path", uriBuilder.build().toString());
    }
View Full Code Here

    public void testNullHost() {
        UriBuilder uriBuilder = UriBuilder.fromPath("/path");
        uriBuilder = uriBuilder.host("localhost");
        assertEquals("//localhost/path", uriBuilder.build().toString());

        uriBuilder = uriBuilder.host(null);
        assertEquals("/path", uriBuilder.build().toString());
    }

    public void testBuildWithQueryParam() {
        URI uri = UriBuilder.fromPath("http://localhost:8080").queryParam("a", "b").build();
View Full Code Here

   @Test
   public void testNullHost()
   {
      UriBuilder builder = UriBuilder.fromUri("http://example.com/foo/bar");
      builder.scheme(null);
      builder.host(null);
      URI uri = builder.build();
      System.out.println(uri.toString());
      Assert.assertEquals(uri.toString(), "/foo/bar");

   }
View Full Code Here

      }

      /*
       * workaround because of host name is cached by uriInfo
       */
      uriBuilder.host(request.getServerName()).port(request.getServerPort());
      uriBuilder.scheme(request.getScheme());

      String uriString = uriBuilder.build().toString();
      if (!uriString.endsWith("/")) {
        uriString = uriString + "/";
View Full Code Here

      }

      /*
       * workaround because of host name is cached by uriInfo
       */
      uriBuilder.host(request.getServerName());

      String uriString = uriBuilder.build().toString();
      if (!uriString.endsWith("/")) {
        uriString = uriString + "/";
      }
View Full Code Here

    }

    public void testBuildMethods() {
        UriBuilder builder = new UriBuilderImpl();
        String[] segments = new String[] {"some", "{v1}", "path{v2}", "{v3}", "a+b{v4}"};
        builder.host("localhost").port(8080).segment(segments).fragment("{v5}");

        // build
        URI uri = builder.build("path", "Ex", "a#b", "c%2Bd", "frag");
        String uriString = uri.toString();
        assertEquals("//localhost:8080/some/path/pathEx/a%23b/a+bc%252Bd#frag", uriString);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.