mirror of https://github.com/apache/jclouds.git
Added methods to ModifyRequest to add multiple query parameters
This commit is contained in:
parent
45a1bcac85
commit
69163eb447
|
@ -102,6 +102,21 @@ public class ModifyRequest {
|
|||
return (R) request.toBuilder().endpoint(builder.build()).build();
|
||||
}
|
||||
|
||||
public static <R extends HttpRequest> R addQueryParams(R request, Multimap<String, String> parameters, UriBuilder builder) {
|
||||
return addQueryParams(request, parameters, builder, request.getSkips());
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static <R extends HttpRequest> R addQueryParams(R request,
|
||||
Multimap<String, String> parameters, UriBuilder builder, char... skips) {
|
||||
builder.uri(request.getEndpoint());
|
||||
Multimap<String, String> map =
|
||||
org.jclouds.http.utils.ModifyRequest.parseQueryToMap(request.getEndpoint().getQuery());
|
||||
map.putAll(parameters);
|
||||
builder.replaceQuery(org.jclouds.http.utils.ModifyRequest.makeQueryLine(map, null, skips));
|
||||
return (R) request.toBuilder().endpoint(builder.build()).build();
|
||||
}
|
||||
|
||||
public static <R extends HttpRequest> R replaceMatrixParam(R request, String name, Object value, UriBuilder builder) {
|
||||
return replaceMatrixParam(request, name, new Object[] { value }, builder);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue