|
20 | 20 | package org.elasticsearch.rest.action.admin.indices; |
21 | 21 |
|
22 | 22 | import org.elasticsearch.action.admin.indices.settings.get.GetSettingsRequest; |
23 | | -import org.elasticsearch.action.admin.indices.settings.get.GetSettingsResponse; |
24 | 23 | import org.elasticsearch.action.support.IndicesOptions; |
25 | 24 | import org.elasticsearch.client.node.NodeClient; |
26 | 25 | import org.elasticsearch.common.Strings; |
27 | 26 | import org.elasticsearch.common.settings.Settings; |
28 | | -import org.elasticsearch.common.xcontent.XContentBuilder; |
29 | 27 | import org.elasticsearch.rest.BaseRestHandler; |
30 | | -import org.elasticsearch.rest.BytesRestResponse; |
31 | 28 | import org.elasticsearch.rest.RestController; |
32 | 29 | import org.elasticsearch.rest.RestRequest; |
33 | | -import org.elasticsearch.rest.RestResponse; |
34 | | -import org.elasticsearch.rest.action.RestBuilderListener; |
| 30 | +import org.elasticsearch.rest.action.RestToXContentListener; |
35 | 31 |
|
36 | 32 | import java.io.IOException; |
37 | 33 |
|
38 | 34 | import static org.elasticsearch.rest.RestRequest.Method.GET; |
39 | | -import static org.elasticsearch.rest.RestStatus.OK; |
40 | 35 |
|
41 | 36 | public class RestGetSettingsAction extends BaseRestHandler { |
42 | 37 |
|
@@ -68,15 +63,6 @@ public RestChannelConsumer prepareRequest(final RestRequest request, final NodeC |
68 | 63 | .names(names); |
69 | 64 | getSettingsRequest.local(request.paramAsBoolean("local", getSettingsRequest.local())); |
70 | 65 | getSettingsRequest.masterNodeTimeout(request.paramAsTime("master_timeout", getSettingsRequest.masterNodeTimeout())); |
71 | | - |
72 | | - return channel -> client.admin().indices().getSettings(getSettingsRequest, new RestBuilderListener<GetSettingsResponse>(channel) { |
73 | | - |
74 | | - @Override |
75 | | - public RestResponse buildResponse(GetSettingsResponse getSettingsResponse, XContentBuilder builder) throws Exception { |
76 | | - getSettingsResponse.toXContent(builder, request); |
77 | | - return new BytesRestResponse(OK, builder); |
78 | | - } |
79 | | - }); |
| 66 | + return channel -> client.admin().indices().getSettings(getSettingsRequest, new RestToXContentListener<>(channel)); |
80 | 67 | } |
81 | | - |
82 | 68 | } |
0 commit comments