diff --git a/modules/transport-netty4/src/test/java/org/elasticsearch/http/netty4/Netty4HttpServerTransportTests.java b/modules/transport-netty4/src/test/java/org/elasticsearch/http/netty4/Netty4HttpServerTransportTests.java index b0a42470bdb22..c08d571eaf6bb 100644 --- a/modules/transport-netty4/src/test/java/org/elasticsearch/http/netty4/Netty4HttpServerTransportTests.java +++ b/modules/transport-netty4/src/test/java/org/elasticsearch/http/netty4/Netty4HttpServerTransportTests.java @@ -614,7 +614,7 @@ public void dispatchRequest(final RestRequest request, final RestChannel channel channel.sendResponse( RestResponse.chunked(OK, ChunkedRestResponseBody.fromXContent(ignored -> Iterators.single((builder, params) -> { throw new AssertionError("should not be called for HEAD REQUEST"); - }), ToXContent.EMPTY_PARAMS, channel)) + }), ToXContent.EMPTY_PARAMS, channel, null)) ); } catch (IOException e) { throw new AssertionError(e); diff --git a/server/src/main/java/org/elasticsearch/rest/ChunkedRestResponseBody.java b/server/src/main/java/org/elasticsearch/rest/ChunkedRestResponseBody.java index fb73677e265f4..9cfe7b84577db 100644 --- a/server/src/main/java/org/elasticsearch/rest/ChunkedRestResponseBody.java +++ b/server/src/main/java/org/elasticsearch/rest/ChunkedRestResponseBody.java @@ -57,21 +57,6 @@ public interface ChunkedRestResponseBody extends Releasable { */ String getResponseContentTypeString(); - /** - * Create a chunked response body to be written to a specific {@link RestChannel} from a {@link ChunkedToXContent}. - * - * @param chunkedToXContent chunked x-content instance to serialize - * @param params parameters to use for serialization - * @param channel channel the response will be written to - * @return chunked rest response body - * @deprecated Use {@link #fromXContent(ChunkedToXContent, ToXContent.Params, RestChannel, Releasable)} instead. - */ - @Deprecated(forRemoval = true) - static ChunkedRestResponseBody fromXContent(ChunkedToXContent chunkedToXContent, ToXContent.Params params, RestChannel channel) - throws IOException { - return fromXContent(chunkedToXContent, params, channel, null); - } - /** * Create a chunked response body to be written to a specific {@link RestChannel} from a {@link ChunkedToXContent}. * @@ -162,17 +147,6 @@ public void close() { }; } - /** - * Create a chunked response body to be written to a specific {@link RestChannel} from a stream of text chunks, each represented as a - * consumer of a {@link Writer}. The last chunk that the iterator yields must write at least one byte. - * - * @deprecated Use {@link #fromTextChunks(String, Iterator, Releasable)} instead. - */ - @Deprecated(forRemoval = true) - static ChunkedRestResponseBody fromTextChunks(String contentType, Iterator> chunkIterator) { - return fromTextChunks(contentType, chunkIterator, null); - } - /** * Create a chunked response body to be written to a specific {@link RestChannel} from a stream of text chunks, each represented as a * consumer of a {@link Writer}. The last chunk that the iterator yields must write at least one byte. diff --git a/server/src/main/java/org/elasticsearch/rest/action/RestChunkedToXContentListener.java b/server/src/main/java/org/elasticsearch/rest/action/RestChunkedToXContentListener.java index 77e30883ef702..a3bb1ed9d94dc 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/RestChunkedToXContentListener.java +++ b/server/src/main/java/org/elasticsearch/rest/action/RestChunkedToXContentListener.java @@ -37,7 +37,7 @@ public RestChunkedToXContentListener(RestChannel channel, ToXContent.Params para @Override protected void processResponse(Response response) throws IOException { channel.sendResponse( - RestResponse.chunked(getRestStatus(response), ChunkedRestResponseBody.fromXContent(response, params, channel)) + RestResponse.chunked(getRestStatus(response), ChunkedRestResponseBody.fromXContent(response, params, channel, null)) ); } diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestNodesHotThreadsAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestNodesHotThreadsAction.java index 77d0b0e9a4f3e..095abcd14d355 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestNodesHotThreadsAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestNodesHotThreadsAction.java @@ -115,7 +115,7 @@ public RestChannelConsumer prepareRequest(final RestRequest request, final NodeC return channel -> client.admin().cluster().nodesHotThreads(nodesHotThreadsRequest, new RestResponseListener<>(channel) { @Override public RestResponse buildResponse(NodesHotThreadsResponse response) { - return RestResponse.chunked(RestStatus.OK, fromTextChunks(TEXT_CONTENT_TYPE, response.getTextChunks())); + return RestResponse.chunked(RestStatus.OK, fromTextChunks(TEXT_CONTENT_TYPE, response.getTextChunks(), null)); } }); } diff --git a/server/src/main/java/org/elasticsearch/rest/action/cat/RestTable.java b/server/src/main/java/org/elasticsearch/rest/action/cat/RestTable.java index 5c9887a8e0916..8ce001f7a1a77 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/cat/RestTable.java +++ b/server/src/main/java/org/elasticsearch/rest/action/cat/RestTable.java @@ -77,7 +77,8 @@ public static RestResponse buildXContentBuilder(Table table, RestChannel channel Iterators.single((builder, params) -> builder.endArray()) ), ToXContent.EMPTY_PARAMS, - channel + channel, + null ) ); } @@ -126,7 +127,8 @@ public static RestResponse buildTextPlainResponse(Table table, RestChannel chann } writer.append("\n"); }) - ) + ), + null ) ); } diff --git a/server/src/main/java/org/elasticsearch/rest/action/info/RestClusterInfoAction.java b/server/src/main/java/org/elasticsearch/rest/action/info/RestClusterInfoAction.java index 60ae860ef6ec0..7bcc19cb17fa9 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/info/RestClusterInfoAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/info/RestClusterInfoAction.java @@ -129,7 +129,8 @@ public RestResponse buildResponse(NodesStatsResponse response) throws Exception ChunkedToXContentHelper.endObject() ), EMPTY_PARAMS, - channel + channel, + null ) ); } diff --git a/server/src/test/java/org/elasticsearch/rest/RestResponseTests.java b/server/src/test/java/org/elasticsearch/rest/RestResponseTests.java index 67602be3a83ea..14b5fe7f49482 100644 --- a/server/src/test/java/org/elasticsearch/rest/RestResponseTests.java +++ b/server/src/test/java/org/elasticsearch/rest/RestResponseTests.java @@ -69,7 +69,7 @@ public void testWithHeaders() throws Exception { public void testEmptyChunkedBody() { RestResponse response = RestResponse.chunked( RestStatus.OK, - ChunkedRestResponseBody.fromTextChunks(RestResponse.TEXT_CONTENT_TYPE, Collections.emptyIterator()) + ChunkedRestResponseBody.fromTextChunks(RestResponse.TEXT_CONTENT_TYPE, Collections.emptyIterator(), null) ); assertFalse(response.isChunked()); assertNotNull(response.content());