Code example for URI

Methods: getFragmentgetQuery

        assertEquals("/file", uri.getPath());
        assertEquals("query:colon", uri.getQuery());
    public void testQuestionMarkInFragment() throws Exception { 
        URI uri = new URI("http://host/file#fragment?query");
        assertEquals("/file", uri.getPath());
        assertEquals(null, uri.getQuery());
        assertEquals("fragment?query", uri.getFragment());
    public void testColonInFragment() throws Exception { 
        URI uri = new URI("http://host/file#fragment:80");
        assertEquals("/file", uri.getPath());
        assertEquals(-1, uri.getPort());
        assertEquals("fragment:80", uri.getFragment());
    public void testSlashInFragment() throws Exception { 
        URI uri = new URI("http://host/file#fragment/path");
Connect your IDE to all the code out there  Get Codota for Java