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);
|
||||
}
|
||||
|
||||
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 {
|
||||
URI uri = buildUri(endpoint, params);
|
||||
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 {
|
||||
URIBuilder uriBuilder = new URIBuilder(path);
|
||||
for (Map.Entry<String, Object> param : params.entrySet()) {
|
||||
uriBuilder.addParameter(param.getKey(), param.getValue().toString());
|
||||
for (Map.Entry<String, String> param : params.entrySet()) {
|
||||
uriBuilder.addParameter(param.getKey(), param.getValue());
|
||||
}
|
||||
return uriBuilder.build();
|
||||
} catch(URISyntaxException e) {
|
||||
|
|
|
@ -45,13 +45,13 @@ public class HostsSniffer {
|
|||
private static final Log logger = LogFactory.getLog(HostsSniffer.class);
|
||||
|
||||
private final RestClient restClient;
|
||||
private final Map<String, Object> sniffRequestParams;
|
||||
private final Map<String, String> sniffRequestParams;
|
||||
private final String scheme;
|
||||
private final JsonFactory jsonFactory;
|
||||
|
||||
public HostsSniffer(RestClient restClient, int sniffRequestTimeout, String scheme) {
|
||||
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.jsonFactory = new JsonFactory();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue