我正在 Quarkus 中实现 REST-API,并希望流式传输内容。
我想知道流的传输何时完成。正如http标准所描述的,当消息体的传输完成时,将发送http-trailer字段。因此我想访问 quarkus 中的 http-trailer (https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Trailer)。
如何在 quarkus 中访问 http 预告片信息?
感谢您的支持。
我已阅读文档 - 只有一些关于 grpc 的文档,您可以在其中使用 http-trailers:
https://quarkus.io/guides/grpc-service-conspiration
但我需要 Quarkus REST 中的信息。
Vert.x HTTP 客户端可让您通过
io.vertx.core.http.HttpClientResponse#trailers
访问 HTTP 预告片。
您可以在 Quarkus 中手动创建 Vert.x HTTP 客户端,执行以下操作:
@Singleton
public MyClass {
private final Vertx vertx;
private final WebClient client;
public MyClass(Vertx vertx) {
this.vertx = vertx;
this.client = WebClient.create(vertx);
}
}
请参阅此了解更多信息。