code: public static URI addPathComponent(URI uri, String component) {
          if (uri != null && component != null) try {
              return new URI(uri.getScheme(), uri.getUserInfo(), uri.getHost(), uri.getPort(),
                      Optional.ofNullable(uri.getPath()).map(path -> join(path, component, '/')).orElse(component),
                      uri.getQuery(), uri.getFragment());
          } catch (URISyntaxException use) {
              throw new IllegalArgumentException("Could not add path component \"" + component + "\" to " + uri + ": "
                      + use.getMessage(), use);
          }
          return uri;
      }
docs: This method adds a 'component' to the path of an URI.
  
  @param uri       The URI to add a path component to
  @param component The component to add to the end of the uri path, separated by a slash ({@code '/'}) character
  @return The new URI