code: public static String replacePathParam(final String url, final String param, final String value) throws EncoderException {
  
      final String pathParam = param.startsWith("{") ? param : "{" + param + "}";
      final String encodedValue = encode(value);
      return StringUtils.replace(url, pathParam, encodedValue);
    }
docs: Replaces path param in uri to a valid, encoded value
  
  @param url url to replace in (path params should be in the uri within curly braces)
  @param param name of the path param (not inside curly braces)
  @param value value to encode
  @return url with path param replaced to the value
  @throws EncoderException