|
@@ -9,17 +9,13 @@
|
|
|
package org.elasticsearch.rest.action.admin.indices;
|
|
|
|
|
|
import org.elasticsearch.action.admin.indices.recovery.RecoveryRequest;
|
|
|
-import org.elasticsearch.action.admin.indices.recovery.RecoveryResponse;
|
|
|
import org.elasticsearch.action.support.IndicesOptions;
|
|
|
import org.elasticsearch.client.internal.node.NodeClient;
|
|
|
import org.elasticsearch.common.Strings;
|
|
|
import org.elasticsearch.rest.BaseRestHandler;
|
|
|
-import org.elasticsearch.rest.ChunkedRestResponseBody;
|
|
|
import org.elasticsearch.rest.RestRequest;
|
|
|
-import org.elasticsearch.rest.RestResponse;
|
|
|
-import org.elasticsearch.rest.RestStatus;
|
|
|
-import org.elasticsearch.rest.action.RestActionListener;
|
|
|
import org.elasticsearch.rest.action.RestCancellableNodeClient;
|
|
|
+import org.elasticsearch.rest.action.RestChunkedToXContentListener;
|
|
|
|
|
|
import java.io.IOException;
|
|
|
import java.util.List;
|
|
@@ -55,14 +51,6 @@ public class RestRecoveryAction extends BaseRestHandler {
|
|
|
recoveryRequest.indicesOptions(IndicesOptions.fromRequest(request, recoveryRequest.indicesOptions()));
|
|
|
return channel -> new RestCancellableNodeClient(client, request.getHttpChannel()).admin()
|
|
|
.indices()
|
|
|
- .recoveries(recoveryRequest, new RestActionListener<>(channel) {
|
|
|
- @Override
|
|
|
- protected void processResponse(RecoveryResponse recoveryResponse) throws IOException {
|
|
|
- ensureOpen();
|
|
|
- channel.sendResponse(
|
|
|
- new RestResponse(RestStatus.OK, ChunkedRestResponseBody.fromXContent(recoveryResponse, request, channel))
|
|
|
- );
|
|
|
- }
|
|
|
- });
|
|
|
+ .recoveries(recoveryRequest, new RestChunkedToXContentListener<>(channel));
|
|
|
}
|
|
|
}
|