【问题标题】:Apache HttpComponents URIBuilder rest with multivalue paramsApache HttpComponents URIBuilder 带有多值参数
【发布时间】:2016-01-13 17:09:44
【问题描述】:

我正在尝试向类似这样的端点发送 GET 请求:

  http://{hostname}api/search/artifact?name=junit&repos=snapshot,deploy,release

我有一个带有逗号分隔值的参数 (repos)。我正在寻找一种使用 Apache HttpComponents 的 URIBuilder 发送此请求的方法。我尝试构建 NameValuePair (相同的名称 [repos] 但不同的值),但这种格式对 api 无效。有人可以帮忙吗?

【问题讨论】:

    标签: java rest apache-httpcomponents


    【解决方案1】:

    为什么不自己将多个值组合成一个值“快照、部署、发布”。

    String.join(",", reposList);
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-08-26
      • 1970-01-01
      • 2016-06-12
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多