public final class MetadataUtils extends Object
Modifier and Type | Method and Description |
---|---|
static <T extends AbstractStub<T>> |
attachHeaders(T stub,
io.grpc.Metadata extraHeaders)
Deprecated.
Use
stub.withInterceptors(newAttachHeadersInterceptor(...)) instead. |
static <T extends AbstractStub<T>> |
captureMetadata(T stub,
AtomicReference<io.grpc.Metadata> headersCapture,
AtomicReference<io.grpc.Metadata> trailersCapture)
Deprecated.
Use
stub.withInterceptors(newCaptureMetadataInterceptor()) instead. |
static io.grpc.ClientInterceptor |
newAttachHeadersInterceptor(io.grpc.Metadata extraHeaders)
Returns a client interceptor that attaches a set of headers to requests.
|
static io.grpc.ClientInterceptor |
newCaptureMetadataInterceptor(AtomicReference<io.grpc.Metadata> headersCapture,
AtomicReference<io.grpc.Metadata> trailersCapture)
Captures the last received metadata on a channel.
|
@ExperimentalApi(value="https://github.com/grpc/grpc-java/issues/1789") @Deprecated @InlineMe(replacement="stub.withInterceptors(MetadataUtils.newAttachHeadersInterceptor(extraHeaders))", imports="io.grpc.stub.MetadataUtils") public static <T extends AbstractStub<T>> T attachHeaders(T stub, io.grpc.Metadata extraHeaders)
stub.withInterceptors(newAttachHeadersInterceptor(...))
instead.stub
- to bind the headers to.extraHeaders
- the headers to be passed by each call on the returned stub.extraHeaders
bound to each call.public static io.grpc.ClientInterceptor newAttachHeadersInterceptor(io.grpc.Metadata extraHeaders)
extraHeaders
- the headers to be passed by each call that is processed by the returned
interceptor@ExperimentalApi(value="https://github.com/grpc/grpc-java/issues/1789") @Deprecated @InlineMe(replacement="stub.withInterceptors(MetadataUtils.newCaptureMetadataInterceptor(headersCapture, trailersCapture))", imports="io.grpc.stub.MetadataUtils") public static <T extends AbstractStub<T>> T captureMetadata(T stub, AtomicReference<io.grpc.Metadata> headersCapture, AtomicReference<io.grpc.Metadata> trailersCapture)
stub.withInterceptors(newCaptureMetadataInterceptor())
instead.stub
- to capture forheadersCapture
- to record the last received headerstrailersCapture
- to record the last received trailersheadersCapture
and trailersCapture
.public static io.grpc.ClientInterceptor newCaptureMetadataInterceptor(AtomicReference<io.grpc.Metadata> headersCapture, AtomicReference<io.grpc.Metadata> trailersCapture)
headersCapture
- to record the last received headerstrailersCapture
- to record the last received trailers