Package java.net

Examples of java.net.URI.relativize()


        String url;
        // We need to relativize the method url to the host config
        // so that the hostConfiguration is not overriden by the executeMethod call
        try {
            java.net.URI uri = new URI(this.url);
            uri = uri.relativize(new URI(hostConfiguration.getHostURL()));
            url = uri.toString();
        } catch (Exception e1) {
            url = this.url;
        }
        PostMethod method = new PostMethod(url);
View Full Code Here


        props.setProperty("file-xfer-root", parent.getPath().replace('\\', '/'));
        URI parentURI = parent.toURI();
        try {
            context.getOutboundPayload().attachFile(
                    "text/xml",
                    parentURI.relativize(localFile.toURI()),
                    "sync-load-balancer-xml",
                    props,
                    tmpLbXmlFile);
        } catch (IOException ex) {
            String msg = LbLogUtil.getStringManager().getString(
View Full Code Here

        String priorLastKey = null;
        do {
            PartialListing listing = store.list(key, SWIFT_MAX_LISTING_LENGTH, priorLastKey);
            for (FileMetadata fileMetadata : listing.getFiles()) {
                Path subpath = keyToPath(fileMetadata.getKey());
                String relativePath = pathUri.relativize(subpath.toUri()).getPath();
                if (relativePath.endsWith(FOLDER_SUFFIX)) {
                    status.add(newDirectory(new Path(absolutePath,
                            relativePath.substring(0,relativePath.indexOf(FOLDER_SUFFIX)))));
                } else {
                    status.add(newFile(fileMetadata, subpath));
View Full Code Here

                }
            }
           
            for (String commonPrefix : listing.getCommonPrefixes()) {
                Path subpath = keyToPath(commonPrefix);
                String relativePath = pathUri.relativize(subpath.toUri()).getPath();
                status.add(newDirectory(new Path(absolutePath, relativePath)));
            }
            priorLastKey = listing.getPriorLastKey();
        } while (priorLastKey != null);
View Full Code Here

        props.setProperty("file-xfer-root", parent.getPath().replace('\\', '/'));
        URI parentURI = parent.toURI();
        try {
            context.getOutboundPayload().attachFile(
                    "text/xml",
                    parentURI.relativize(localFile.toURI()),
                    "sync-load-balancer-xml",
                    props,
                    tmpLbXmlFile);
        } catch (IOException ex) {
            String msg = LbLogUtil.getStringManager().getString(
View Full Code Here

        a = new URI("file:///~/first");
        b = new URI("file://tools/~/first");
        assertEquals("Assert 1: URI relativized incorrectly,", new URI(
                "file://tools/~/first"), a.relativize(b));
        assertEquals("Assert 2: URI relativized incorrectly,", new URI(
                "file:///~/first"), b.relativize(a));

        // Both URIs with empty hosts
        b = new URI("file:///~/second");
        assertEquals("Assert 3: URI relativized incorrectly,", new URI(
                "file:///~/second"), a.relativize(b));
View Full Code Here

        // Both URIs with empty hosts
        b = new URI("file:///~/second");
        assertEquals("Assert 3: URI relativized incorrectly,", new URI(
                "file:///~/second"), a.relativize(b));
        assertEquals("Assert 4: URI relativized incorrectly,", new URI(
                "file:///~/first"), b.relativize(a));
    }

    // Regression test for HARMONY-6075
    public void test_relativize3() throws Exception {
        URI uri = new URI("file", null, "/test/location", null);
View Full Code Here

        a = new URI("file:///~/dictionary");
        b = new URI("file://tools/~/dictionary");
        assertEquals("relativized incorrectly,", new URI(
                "file://tools/~/dictionary"), a.relativize(b));
        assertEquals("relativized incorrectly,",
                new URI("file:///~/dictionary"), b.relativize(a));

        // two URIs with empty hosts
        b = new URI("file:///~/therasus");
        assertEquals("relativized incorrectly,", new URI("file:///~/therasus"),
                a.relativize(b));
View Full Code Here

        // two URIs with empty hosts
        b = new URI("file:///~/therasus");
        assertEquals("relativized incorrectly,", new URI("file:///~/therasus"),
                a.relativize(b));
        assertEquals("relativized incorrectly,",
                new URI("file:///~/dictionary"), b.relativize(a));

        URI one = new URI("file:/C:/test/ws");
        URI two = new URI("file:/C:/test/ws");

        URI empty = new URI("");
View Full Code Here

    Queue<File> queue = Lists.newLinkedList();
    Collections.addAll(queue, baseDir.listFiles());
    while (!queue.isEmpty()) {
      File file = queue.remove();

      String entry = entryPrefix + baseUri.relativize(file.toURI()).getPath();
      if (entries.add(entry)) {
        jarOut.putNextEntry(new JarEntry(entry));
        if (file.isFile()) {
          try {
            Files.copy(file, jarOut);
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.