public class MetadataUtils extends Object
Constructor and Description |
---|
MetadataUtils() |
Modifier and Type | Method and Description |
---|---|
static <T extends AbstractStub> |
attachHeaders(T stub,
Metadata.Headers extraHeaders)
Attaches a set of request headers to a stub.
|
static <T extends AbstractStub> |
captureMetadata(T stub,
AtomicReference<Metadata.Headers> headersCapture,
AtomicReference<Metadata.Trailers> trailersCapture)
Captures the last received metadata for a stub.
|
static ClientInterceptor |
newAttachHeadersInterceptor(Metadata.Headers extraHeaders)
Returns a client interceptor that attaches a set of headers to requests.
|
static ClientInterceptor |
newCaptureMetadataInterceptor(AtomicReference<Metadata.Headers> headersCapture,
AtomicReference<Metadata.Trailers> trailersCapture)
Captures the last received metadata on a channel.
|
public static <T extends AbstractStub> T attachHeaders(T stub, Metadata.Headers 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.Headers extraHeaders)
extraHeaders
- the headers to be passed by each call that is processed by the returned
interceptorpublic static <T extends AbstractStub> T captureMetadata(T stub, AtomicReference<Metadata.Headers> headersCapture, AtomicReference<Metadata.Trailers> trailersCapture)
stub
- to capture forheadersCapture
- to record the last received headerstrailersCapture
- to record the last received trailersextraHeaders
bound to each call.public static ClientInterceptor newCaptureMetadataInterceptor(AtomicReference<Metadata.Headers> headersCapture, AtomicReference<Metadata.Trailers> trailersCapture)
headersCapture
- to record the last received headerstrailersCapture
- to record the last received trailers