Code example for URI

Methods: resolve

0
        assertEquals("http://a/b/c/g..", base.resolve("g..").toString());
        assertEquals("http://a/b/c/..g", base.resolve("..g").toString());
    } 
 
    public void testRfc1808AbnormalExampleNonsensicalDots() throws Exception { 
        URI base = new URI("http://a/b/c/d;p?q");
        assertEquals("http://a/b/g", base.resolve("./../g").toString());
        assertEquals("http://a/b/c/g/", base.resolve("./g/.").toString());
        assertEquals("http://a/b/c/g/h", base.resolve("g/./h").toString());
        assertEquals("http://a/b/c/h", base.resolve("g/../h").toString());
        assertEquals("http://a/b/c/g;x=1/y", base.resolve("g;x=1/./y").toString());
        assertEquals("http://a/b/c/y", base.resolve("g;x=1/../y").toString());
    } 
 
    public void testRfc1808AbnormalExampleRelativeScheme() throws Exception { 
        URI base = new URI("http://a/b/c/d;p?q");
        URI uri = base.resolve("http:g");
        assertEquals("http:g", uri.toString()); // this is an opaque URI
        assertEquals(true, uri.isOpaque());
        assertEquals(true, uri.isAbsolute());
    }