code: private static String getPath(String uri) {
          int offset = 0;
          if (uri.startsWith("http://")) {
              offset = "http://".length();
          } else if (uri.startsWith("https://")) {
              offset = "https://".length();
          }
  
          if (offset == 0) {
              return uri;
          } else {
              int firstSlash = uri.indexOf('/', offset);
              return -1 != firstSlash? uri.substring(firstSlash) : uri;
          }
      }
docs: start of the path.