QGrpcInitialMetadataInterceptor Class
拦截 RPC 的初始元数据。更多...
| 标题: | #include <QGrpcInterceptor> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS Grpc) target_link_libraries(mytarget PRIVATE Qt6::Grpc) |
| 自: | Qt 6.11 |
- 所有成员的列表,包括继承的成员
- QGrpcInitialMetadataInterceptor 属于Qt GRPC 拦截器。
注意:该类中的所有函数均为可重入函数。
公共函数
| virtual | ~QGrpcInitialMetadataInterceptor() |
| virtual void | onInitialMetadata(QGrpcInterceptionContext &context, QMultiHash<QByteArray, QByteArray> &metadata) = 0 |
详细描述
实现 QGrpcInitialMetadataInterceptor 以观察或修改与 RPC 相关的初始元数据。
初始元数据由服务器在建立调用后、发送任何响应消息之前立即发送。
有关拦截机制的介绍以及拦截器接口如何参与 RPC 生命周期的信息,请参阅《Qt GRPC 拦截器概述》。
注意:此 拦截器在出站方向运行。有关多个拦截器回调如何流经链的详细信息,请参阅“方向和流”部分。
另请参阅 QtGrpc::InterceptorCapability::InitialMetadata 、QGrpcOperation::serverInitialMetadata()、QGrpcOperation::serverInitialMetadataReceived() 以及QGrpcInterceptionContext 。
成员函数文档
[virtual noexcept] QGrpcInitialMetadataInterceptor::~QGrpcInitialMetadataInterceptor()
摧毁了这架拦截机。
[pure virtual] void QGrpcInitialMetadataInterceptor::onInitialMetadata(QGrpcInterceptionContext &context, QMultiHash<QByteArray, QByteArray> &metadata)
当 RPC 的初始metadata 可用时调用此方法。
context 提供了有关被拦截的 RPC 的信息。在将metadata 转发给 RPC 之前,可以对其进行就地修改。
另请参阅 QGrpcOperation::serverInitialMetadata() 和QGrpcOperation::serverInitialMetadataReceived()。
© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.