Package java.net

Examples of java.net.URI.relativize()


        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));
    }

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

        ChannelSftp c = (ChannelSftp) session.openChannel("sftp");
        c.connect();

        URI url = getClass().getClassLoader().getResource(SshClient.class.getName().replace('.', '/') + ".class").toURI();
        URI base = new File(System.getProperty("user.dir")).getAbsoluteFile().toURI();
        String path = new File(base.relativize(url).getPath()).getParent() + "/";
        path = path.replace('\\', '/');
        Vector res = c.ls(path);
        for (Object f : res) {
            System.out.println(f.toString());
        }
View Full Code Here

            List<org.opensaml.saml1.core.Attribute> attributes = statement.getAttributes();
            for (org.opensaml.saml1.core.Attribute attribute : attributes) {

                URI attributeNamespace = URI.create(attribute.getAttributeNamespace());
                String desiredRole = attributeNamespace.relativize(claimURI).toString();
                if (attribute.getAttributeName().equals(desiredRole)
                        && attribute.getAttributeValues() != null && !attribute.getAttributeValues().isEmpty()) {
                    return null;
                }
            }
View Full Code Here

            URI baseURI = configurationDir.getAbsoluteFile().toURI();
            Collection files = listRecursiveFiles(configurationDir);
            for (Iterator iterator = files.iterator(); iterator.hasNext();) {
                File file = (File) iterator.next();
                String relativePath = baseURI.relativize(file.toURI()).getPath();
                if (!EXCLUDED.contains(relativePath)) {
                    InputStream in = new FileInputStream(file);
                    try {
                        out.putNextEntry(new ZipEntry(relativePath));
                        try {
View Full Code Here

        }
       
        // Direct siblings? (ie. in same folder)
        URI commonBase = baseRel.resolve("./");
        if (commonBase.equals(uriRel.resolve("./"))) {
            return commonBase.relativize(uriRel);
        }
       
        // No, then just keep climbing up until we find a common base.
        URI relative = URI.create("");
        while (!(uriRel.getPath().startsWith(commonBase.getPath())) && !(commonBase.getPath().equals("/"))) {
View Full Code Here

    do {
      PartialListing listing = store.list(key, S3_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 {
View Full Code Here

          status.add(newFile(fileMetadata, subpath));
        }
      }
      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

      entityFeedPropertiesBuilder =
          EntityProviderWriteProperties.serviceRoot(pathInfo.getServiceRoot());
      JPAPaging paging = odataJPAContext.getPaging();
      if (odataJPAContext.getPageSize() > 0 && paging != null && paging.getNextPage() > 0) {
        String nextLink =
            serviceRoot.relativize(pathInfo.getRequestUri()).toString();
        nextLink = percentEncodeNextLink(nextLink);
        nextLink += (nextLink.contains("?") ? "&" : "?")
            + "$skiptoken=" + odataJPAContext.getPaging().getNextPage();
        entityFeedPropertiesBuilder.nextLink(nextLink);
      }
View Full Code Here

    String priorLastKey = null;
    do {
      PartialListing listing = store.list(key, S3_MAX_LISTING_LENGTH, priorLastKey, false);
      for (FileMetadata fileMetadata : listing.getFiles()) {
        Path subpath = keyToPath(fileMetadata.getKey());
        String relativePath = pathUri.relativize(subpath.toUri()).getPath();

        if (fileMetadata.getKey().equals(key + "/")) {
          // this is just the directory we have been asked to list
        }
        else if (relativePath.endsWith(FOLDER_SUFFIX)) {
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.