io.vertx.grpc

## Class ContextServerInterceptor

- java.lang.Object
- - io.vertx.grpc.ContextServerInterceptor

- All Implemented Interfaces:
    io.grpc.ServerInterceptor

      public abstract class ContextServerInterceptor
      extends Object
      implements io.grpc.ServerInterceptor

  An abstract interceptor that allows capturing data from the metadata to the vertx context so it can be used later on the asynchronous APIs.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ContextServerInterceptor()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `abstract void` | `bind(io.grpc.Metadata metadata, ConcurrentMap<String,String> context)` This method is called before the `interceptCall(ServerCall, Metadata, ServerCallHandler)` call happens and allows extracting data from the metadata to the vert.x context.
    `static <T> T` | `get(String key)`
    `static <T> T` | `getOrDefault(String key, T defaultValue)`
    `<ReqT,RespT> io.grpc.ServerCall.Listener<ReqT>` | `interceptCall(io.grpc.ServerCall<ReqT,RespT> call, io.grpc.Metadata metadata, io.grpc.ServerCallHandler<ReqT,RespT> handler)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### ContextServerInterceptor

          public ContextServerInterceptor()

  - ### Method Detail

    - #### bind

          public abstract void bind(io.grpc.Metadata metadata,
                                    ConcurrentMap<String,String> context)

      This method is called before the `interceptCall(ServerCall, Metadata, ServerCallHandler)` call happens and allows extracting data from the metadata to the vert.x context.
      Parameters:
        `metadata` - the grpc connection context
        `context` - the vertx context map

    - #### interceptCall

          public <ReqT,RespT> io.grpc.ServerCall.Listener<ReqT> interceptCall(io.grpc.ServerCall<ReqT,RespT> call,
                                                                              io.grpc.Metadata metadata,
                                                                              io.grpc.ServerCallHandler<ReqT,RespT> handler)

      Specified by:
        `interceptCall` in interface `io.grpc.ServerInterceptor`

    - #### get

          public static <T> T get(String key)

    - #### getOrDefault

          public static <T> T getOrDefault(String key,
                                           T defaultValue)

Copyright © 2021 Eclipse. All rights reserved.