private static HttpResponseWriter aggregateFrom(CompletableFuture<?> future,
                                                    ResponseHeaders headers, HttpHeaders trailers,
                                                    Function<Object, HttpData> contentConverter) {
        final HttpResponseWriter writer = HttpResponse.streaming();
        future.handle((result, cause) -> {
            if (cause != null) {
                writer.close(cause);
                return null;
            }
            try {
                final HttpData content = contentConverter.apply(result);
                writer.write(headers);
                writer.write(content);
                if (!trailers.isEmpty()) {
                    writer.write(trailers);
                }
                writer.close();
            } catch (Exception e) {
                writer.close(e);
            }
            return null;
        });
        return writer;
    }
Returns a new {@link HttpResponseWriter} which has a content converted from the collected objects.
 @param publisher publishes objects
@param headers to be written to the returned {@link HttpResponseWriter}
@param trailers to be written to the returned {@link HttpResponseWriter}
@param contentConverter converts the collected objects into a content of the response
@param ctx {@link ServiceRequestContext}
core/src/main/java/com/linecorp/armeria/internal/server/ResponseConversionUtil.java