diff --git a/independent-projects/resteasy-reactive/server/vertx/src/main/java/org/jboss/resteasy/reactive/server/vertx/ResteasyReactiveOutputStream.java b/independent-projects/resteasy-reactive/server/vertx/src/main/java/org/jboss/resteasy/reactive/server/vertx/ResteasyReactiveOutputStream.java index 7d8b00d4faaee..40095ddcaf425 100644 --- a/independent-projects/resteasy-reactive/server/vertx/src/main/java/org/jboss/resteasy/reactive/server/vertx/ResteasyReactiveOutputStream.java +++ b/independent-projects/resteasy-reactive/server/vertx/src/main/java/org/jboss/resteasy/reactive/server/vertx/ResteasyReactiveOutputStream.java @@ -8,6 +8,7 @@ import javax.ws.rs.core.HttpHeaders; import javax.ws.rs.core.MultivaluedMap; +import io.netty.buffer.Unpooled; import org.jboss.logging.Logger; import org.jboss.resteasy.reactive.server.core.LazyResponse; import org.jboss.resteasy.reactive.server.core.ResteasyReactiveRequestContext; @@ -24,6 +25,7 @@ public class ResteasyReactiveOutputStream extends OutputStream { private static final Logger log = Logger.getLogger("org.jboss.resteasy.reactive.server.vertx.ResteasyReactiveOutputStream"); + private static final Buffer EMPTY_BUFFER = Buffer.buffer(Unpooled.EMPTY_BUFFER); private final ResteasyReactiveRequestContext context; protected final HttpServerRequest request; private final int outputBufferSize; @@ -80,7 +82,7 @@ Buffer createBuffer(ByteBuf data) { public void write(ByteBuf data, boolean last) throws IOException { if (last && data == null) { - request.response().end(); + request.response().end(EMPTY_BUFFER, null); return; } //do all this in the same lock @@ -104,9 +106,9 @@ public void write(ByteBuf data, boolean last) throws IOException { data.release(); } else { if (last) { - request.response().end(createBuffer(data)); + request.response().end(createBuffer(data), null); } else { - request.response().write(createBuffer(data)); + request.response().write(createBuffer(data), null); } } } catch (Exception e) { @@ -160,9 +162,9 @@ public void handle(Void event) { if (overflow != null) { if (overflow.size() > 0) { if (closed) { - request.response().end(Buffer.buffer(overflow.toByteArray())); + request.response().end(Buffer.buffer(overflow.toByteArray()), null); } else { - request.response().write(Buffer.buffer(overflow.toByteArray())); + request.response().write(Buffer.buffer(overflow.toByteArray()), null); } overflow.reset(); }