code: protected static Path getPath(int startindex, String[] uriParts) {
          Path ret = Paths.get("/");
          List<FileSystem> toClose = new ArrayList<FileSystem>();
  
          try {
              for (int i = startindex; i < uriParts.length; i++) {
                  String name = uriParts[i];
                  if (name.endsWith("!")) {
                      name = name.substring(0, name.length() - 1);
                  }
                  ret = ret.resolve(name);
  
                  if (name.endsWith(".jar") || name.endsWith(".war")) {
                      try (FileSystem jarfs = FileSystems.newFileSystem(ret,
                              Thread.currentThread().getContextClassLoader())) {
                          ret = jarfs.getRootDirectories().iterator().next();
                      } catch (IOException e) {
                          log.log(Level.SEVERE, "Failed to access archive '" + name + "'", e);
                      }
                  }
              }
          } finally {
              for (FileSystem fs : toClose) {
                  try {
                      fs.close();
                  } catch (IOException e) {
                      log.log(Level.SEVERE, "Failed to close file system '" + fs + "'", e);
                  }
              }
          }
  
          return ret;
      }
docs: This method constructs a path based on potentially accessing
  one or more archive files (jar/war).
  
  @param startindex The start index
  @param uriParts The parts of the URI
  @return The path