Code example for URI

Methods: resolve

0
        URI base = new URI("http://host/a/b/c");
        assertEquals("http://host/d", base.resolve("/d").toString());
    } 
 
    public void testRelativeFullUrl() throws Exception { 
        URI base = new URI("http://host/a/b/c");
        assertEquals("http://host2/d/e", base.resolve("http://host2/d/e").toString());
        assertEquals("https://host2/d/e", base.resolve("https://host2/d/e").toString());
    } 
 
    public void testRelativeDifferentScheme() throws Exception { 
        URI base = new URI("http://host/a/b/c");
        assertEquals("https://host2/d/e", base.resolve("https://host2/d/e").toString());
    } 
 
    public void testRelativeDifferentAuthority() throws Exception { 
        URI base = new URI("http://host/a/b/c");
        assertEquals("http://another/d/e", base.resolve("//another/d/e").toString());
    } 
 
    public void testRelativeWithScheme() throws Exception {