public class MetadataUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static <T extends AbstractStub<T>> |
attachHeaders(T stub,
Metadata extraHeaders)
Attaches a set of request headers to a stub.
|
static <T extends AbstractStub<T>> |
captureMetadata(T stub,
AtomicReference<Metadata> headersCapture,
AtomicReference<Metadata> trailersCapture)
Captures the last received metadata for a stub.
|
static ClientInterceptor |
newAttachHeadersInterceptor(Metadata extraHeaders)
Returns a client interceptor that attaches a set of headers to requests.
|
static ClientInterceptor |
newCaptureMetadataInterceptor(AtomicReference<Metadata> headersCapture,
AtomicReference<Metadata> trailersCapture)
Captures the last received metadata on a channel.
|
@ExperimentalApi(value="https://github.com/grpc/grpc-java/issues/1789") public static <T extends AbstractStub<T>> T attachHeaders(T stub, Metadata extraHeaders)
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 ClientInterceptor newAttachHeadersInterceptor(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") public static <T extends AbstractStub<T>> T captureMetadata(T stub, AtomicReference<Metadata> headersCapture, AtomicReference<Metadata> trailersCapture)
stub - to capture forheadersCapture - to record the last received headerstrailersCapture - to record the last received trailersheadersCapture and trailersCapture.public static ClientInterceptor newCaptureMetadataInterceptor(AtomicReference<Metadata> headersCapture, AtomicReference<Metadata> trailersCapture)
headersCapture - to record the last received headerstrailersCapture - to record the last received trailers