简体   繁体   English

Apache HttpComponents URIBuilder包含多值参数

[英]Apache HttpComponents URIBuilder rest with multivalue params

I am trying to send a GET request to an endpoint similar to this: 我正在尝试将GET请求发送到类似于以下内容的端点:

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

I have a parameter (repos) with comma separated values. 我有一个用逗号分隔值的参数(回购)。 I am looking a way to send this request with URIBuilder of Apache HttpComponents. 我正在寻找一种使用Apache HttpComponents的URIBuilder发送此请求的方法。 I have tried constructing NameValuePair ( same name[repos] but different values), but this is format is not valid for the api. 我试过构造NameValuePair(同名[repos]但值不同),但这对于api来说格式无效。 Can anybody help? 有人可以帮忙吗?

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

String.join(",", reposList);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM