|
33 | 33 | import org.jboss.resteasy.reactive.server.spi.ServerRestHandler;
|
34 | 34 | import org.jboss.resteasy.reactive.spi.ThreadSetupAction;
|
35 | 35 |
|
| 36 | +import io.netty.buffer.ByteBufUtil; |
36 | 37 | import io.netty.buffer.Unpooled;
|
37 | 38 | import io.netty.channel.EventLoop;
|
38 | 39 | import io.netty.handler.codec.http.HttpHeaderNames;
|
39 | 40 | import io.netty.handler.codec.http.QueryStringDecoder;
|
| 41 | +import io.netty.util.CharsetUtil; |
40 | 42 | import io.netty.util.concurrent.ScheduledFuture;
|
| 43 | +import io.quarkus.vertx.utils.NoBoundChecksBuffer; |
41 | 44 | import io.quarkus.vertx.utils.VertxJavaIoContext;
|
42 | 45 | import io.quarkus.vertx.utils.VertxOutputStream;
|
43 | 46 | import io.vertx.core.AsyncResult;
|
|
46 | 49 | import io.vertx.core.MultiMap;
|
47 | 50 | import io.vertx.core.Vertx;
|
48 | 51 | import io.vertx.core.buffer.Buffer;
|
| 52 | +import io.vertx.core.buffer.impl.VertxByteBufAllocator; |
49 | 53 | import io.vertx.core.http.HttpServerRequest;
|
50 | 54 | import io.vertx.core.http.HttpServerResponse;
|
51 | 55 | import io.vertx.core.http.impl.Http1xServerResponse;
|
@@ -399,13 +403,17 @@ public boolean headWritten() {
|
399 | 403 |
|
400 | 404 | @Override
|
401 | 405 | public ServerHttpResponse end(byte[] data) {
|
402 |
| - response.end(Buffer.buffer(data), null); |
| 406 | + var buffer = VertxByteBufAllocator.POOLED_ALLOCATOR.directBuffer(data.length); |
| 407 | + buffer.writeBytes(data); |
| 408 | + response.end(new NoBoundChecksBuffer(buffer), null); |
403 | 409 | return this;
|
404 | 410 | }
|
405 | 411 |
|
406 | 412 | @Override
|
407 | 413 | public ServerHttpResponse end(String data) {
|
408 |
| - response.end(Buffer.buffer(data), null); |
| 414 | + var buffer = VertxByteBufAllocator.POOLED_ALLOCATOR.directBuffer(ByteBufUtil.utf8MaxBytes(data.length())); |
| 415 | + buffer.writeCharSequence(data, CharsetUtil.UTF_8); |
| 416 | + response.end(new NoBoundChecksBuffer(buffer), null); |
409 | 417 | return this;
|
410 | 418 | }
|
411 | 419 |
|
|
0 commit comments