Move RestGetSettingsAction to RestToXContentListener (#31101)
This commit is contained in:
parent
d09d60858a
commit
23d156f023
|
@ -20,23 +20,18 @@
|
|||
package org.elasticsearch.rest.action.admin.indices;
|
||||
|
||||
import org.elasticsearch.action.admin.indices.settings.get.GetSettingsRequest;
|
||||
import org.elasticsearch.action.admin.indices.settings.get.GetSettingsResponse;
|
||||
import org.elasticsearch.action.support.IndicesOptions;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.rest.BaseRestHandler;
|
||||
import org.elasticsearch.rest.BytesRestResponse;
|
||||
import org.elasticsearch.rest.RestController;
|
||||
import org.elasticsearch.rest.RestRequest;
|
||||
import org.elasticsearch.rest.RestResponse;
|
||||
import org.elasticsearch.rest.action.RestBuilderListener;
|
||||
import org.elasticsearch.rest.action.RestToXContentListener;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import static org.elasticsearch.rest.RestRequest.Method.GET;
|
||||
import static org.elasticsearch.rest.RestStatus.OK;
|
||||
|
||||
public class RestGetSettingsAction extends BaseRestHandler {
|
||||
|
||||
|
@ -68,15 +63,6 @@ public class RestGetSettingsAction extends BaseRestHandler {
|
|||
.names(names);
|
||||
getSettingsRequest.local(request.paramAsBoolean("local", getSettingsRequest.local()));
|
||||
getSettingsRequest.masterNodeTimeout(request.paramAsTime("master_timeout", getSettingsRequest.masterNodeTimeout()));
|
||||
|
||||
return channel -> client.admin().indices().getSettings(getSettingsRequest, new RestBuilderListener<GetSettingsResponse>(channel) {
|
||||
|
||||
@Override
|
||||
public RestResponse buildResponse(GetSettingsResponse getSettingsResponse, XContentBuilder builder) throws Exception {
|
||||
getSettingsResponse.toXContent(builder, request);
|
||||
return new BytesRestResponse(OK, builder);
|
||||
}
|
||||
});
|
||||
return channel -> client.admin().indices().getSettings(getSettingsRequest, new RestToXContentListener<>(channel));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue