code: public String encodedPath() {
          int pathStart = url.indexOf('/', scheme.length() + 3); // "://".length() == 3.
          int pathEnd = delimiterOffset(url, pathStart, url.length(), "?#");
          return url.substring(pathStart, pathEnd);
      }
docs: Returns the entire path of this URL encoded for use in HTTP resource resolution. The returned
  path will start with {@code "/"}.
  
  <p><table summary="">
  <tr><th>URL</th><th>{@code encodedPath()}</th></tr>
  <tr><td>{@code http://host/}</td><td>{@code "/"}</td></tr>
  <tr><td>{@code http://host/a/b/c}</td><td>{@code "/a/b/c"}</td></tr>
  <tr><td>{@code http://host/a/b%20c/d}</td><td>{@code "/a/b%20c/d"}</td></tr>
  </table>