Package java.net

Examples of java.net.URI.normalize()


     * @tests java.net.URI#normalize()
     */
    public void test_normalize2() throws URISyntaxException {
        URI uri1 = null, uri2 = null;
        uri1 = new URI("file:/D:/one/two/../../three");
        uri2 = uri1.normalize();

        assertEquals("Normalized to incorrect URI", "file:/D:/three", uri2
                .toString());
        assertTrue("Resolved URI is not absolute", uri2.isAbsolute());
        assertFalse("Resolved URI is opaque", uri2.isOpaque());
View Full Code Here


     */
    public void test_normalize3() throws URISyntaxException {
        // return same URI if it has a normalized path already
        URI uri1 = null, uri2 = null;
        uri1 = new URI("http://host/D:/one/two/three");
        uri2 = uri1.normalize();
        assertSame("Failed to return same URI after normalization", uri1, uri2);

        // try with empty path
        uri1 = new URI("http", "host", null, "fragment");
        uri2 = uri1.normalize();
View Full Code Here

        uri2 = uri1.normalize();
        assertSame("Failed to return same URI after normalization", uri1, uri2);

        // try with empty path
        uri1 = new URI("http", "host", null, "fragment");
        uri2 = uri1.normalize();
        assertSame("Failed to return same URI after normalization", uri1, uri2);
    }

    /**
     * @tests java.net.URI#parseServerAuthority()
View Full Code Here

                "/a/..b/c", "/a/b..c/d", "", "a", "a/b", "a/b/c", "../", "",
                "..", "../g", "b/c/g", "../c/e", "../c/", };

        for (int i = 0; i < normalizeData.length; i++) {
            URI test = new URI(normalizeData[i]);
            String result = test.normalize().toString();
            assertEquals("Normalized incorrectly, ", normalizeResults[i],
                    result.toString());
        }
    }
View Full Code Here

     * @tests java.net.URI#normalize()
     */
    public void test_normalize2() throws URISyntaxException {
        URI uri1 = null, uri2 = null;
        uri1 = new URI("file:/D:/one/two/../../three");
        uri2 = uri1.normalize();

        assertEquals("Normalized to incorrect URI", "file:/D:/three", uri2
                .toString());
        assertTrue("Resolved URI is not absolute", uri2.isAbsolute());
        assertFalse("Resolved URI is opaque", uri2.isOpaque());
View Full Code Here

     */
    public void test_normalize3() throws URISyntaxException {
        // return same URI if it has a normalized path already
        URI uri1 = null, uri2 = null;
        uri1 = new URI("http://host/D:/one/two/three");
        uri2 = uri1.normalize();
        assertSame("Failed to return same URI after normalization", uri1, uri2);

        // try with empty path
        uri1 = new URI("http", "host", null, "fragment");
        uri2 = uri1.normalize();
View Full Code Here

        uri2 = uri1.normalize();
        assertSame("Failed to return same URI after normalization", uri1, uri2);

        // try with empty path
        uri1 = new URI("http", "host", null, "fragment");
        uri2 = uri1.normalize();
        assertSame("Failed to return same URI after normalization", uri1, uri2);
    }

    /**
     * @tests java.net.URI#parseServerAuthority()
View Full Code Here

            URI uri = new URI(url.getProtocol(), url.getAuthority(),
                    url.getPath(), url.getQuery(), url.getRef());
           
            // it is possible that the original url was already (partial) escaped,
            // so we must unescape all '%' followed by 2 hexadecimals...
            String uriString = uri.normalize().toASCIIString();
           
            // manually escape the '+' character
            uriString = uriString.replaceAll("\\+", "%2B");
           
            return ESCAPE_PATTERN.matcher(uriString).replaceAll("%$1");
View Full Code Here

      ret_url = ret_url.replace("%5F", "_");

      // Remove dot-segments.
      // http://www.example.com/../a/b/../c/./d.html => http://www.example.com/a/c/d.html        
      URI uri = new URI(ret_url);
      uri = uri.normalize();
      ret_url = uri.toURL().toExternalForm();

      // Remove dot-segments at the beginning of the path
      // http://www.example.com/../a/d.html => http://www.example.com/a/d.html        
      URL tempUrl = new URL(ret_url);
View Full Code Here

        } else {
          // OK the parent is in here, let's add the child URI
          this.childMap.get(parentLocation).add(childLocation);
        }
        // Set the context to the childLocation
        contextURI = childLocation.normalize();
      }
     
      // OK let's add the object
      this.objectMap.put(contextURI, digitalObject);
      storeLocation = contextURI;
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.