adapt params argument, they can only be Strings in performRequest method
This commit is contained in:
parent
3890842fd4
commit
1d06916b07
|
@ -77,7 +77,7 @@ public final class RestClient implements Closeable {
|
||||||
this.connections = Collections.unmodifiableList(connections);
|
this.connections = Collections.unmodifiableList(connections);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ElasticsearchResponse performRequest(String method, String endpoint, Map<String, Object> params,
|
public ElasticsearchResponse performRequest(String method, String endpoint, Map<String, String> params,
|
||||||
HttpEntity entity, Header... headers) throws IOException {
|
HttpEntity entity, Header... headers) throws IOException {
|
||||||
URI uri = buildUri(endpoint, params);
|
URI uri = buildUri(endpoint, params);
|
||||||
HttpRequestBase request = createHttpRequest(method, uri, entity);
|
HttpRequestBase request = createHttpRequest(method, uri, entity);
|
||||||
|
@ -252,11 +252,11 @@ public final class RestClient implements Closeable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static URI buildUri(String path, Map<String, Object> params) {
|
private static URI buildUri(String path, Map<String, String> params) {
|
||||||
try {
|
try {
|
||||||
URIBuilder uriBuilder = new URIBuilder(path);
|
URIBuilder uriBuilder = new URIBuilder(path);
|
||||||
for (Map.Entry<String, Object> param : params.entrySet()) {
|
for (Map.Entry<String, String> param : params.entrySet()) {
|
||||||
uriBuilder.addParameter(param.getKey(), param.getValue().toString());
|
uriBuilder.addParameter(param.getKey(), param.getValue());
|
||||||
}
|
}
|
||||||
return uriBuilder.build();
|
return uriBuilder.build();
|
||||||
} catch(URISyntaxException e) {
|
} catch(URISyntaxException e) {
|
||||||
|
|
|
@ -45,13 +45,13 @@ public class HostsSniffer {
|
||||||
private static final Log logger = LogFactory.getLog(HostsSniffer.class);
|
private static final Log logger = LogFactory.getLog(HostsSniffer.class);
|
||||||
|
|
||||||
private final RestClient restClient;
|
private final RestClient restClient;
|
||||||
private final Map<String, Object> sniffRequestParams;
|
private final Map<String, String> sniffRequestParams;
|
||||||
private final String scheme;
|
private final String scheme;
|
||||||
private final JsonFactory jsonFactory;
|
private final JsonFactory jsonFactory;
|
||||||
|
|
||||||
public HostsSniffer(RestClient restClient, int sniffRequestTimeout, String scheme) {
|
public HostsSniffer(RestClient restClient, int sniffRequestTimeout, String scheme) {
|
||||||
this.restClient = restClient;
|
this.restClient = restClient;
|
||||||
this.sniffRequestParams = Collections.<String, Object>singletonMap("timeout", sniffRequestTimeout + "ms");
|
this.sniffRequestParams = Collections.<String, String>singletonMap("timeout", sniffRequestTimeout + "ms");
|
||||||
this.scheme = scheme;
|
this.scheme = scheme;
|
||||||
this.jsonFactory = new JsonFactory();
|
this.jsonFactory = new JsonFactory();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue