Class GlobalServerInterceptorRegistry

java.lang.Object
net.devh.boot.grpc.server.interceptor.GlobalServerInterceptorRegistry

public class GlobalServerInterceptorRegistry extends Object
The global server interceptor registry keeps references to all ServerInterceptors that should be registered to all server channels. The interceptors will be applied in the same order they as specified by the sortInterceptors(List) method.

Note: Custom interceptors will be appended to the global interceptors and applied using ServerInterceptors.interceptForward(BindableService, ServerInterceptor...).

  • Constructor Details

    • GlobalServerInterceptorRegistry

      public GlobalServerInterceptorRegistry(ApplicationContext applicationContext)
      Creates a new GlobalServerInterceptorRegistry.
      Parameters:
      applicationContext - The application context to fetch the GlobalServerInterceptorConfigurer beans from.
  • Method Details

    • getServerInterceptors

      public ImmutableList<ServerInterceptor> getServerInterceptors()
      Gets the immutable list of global server interceptors.
      Returns:
      The list of globally registered server interceptors.
    • initServerInterceptors

      protected List<ServerInterceptor> initServerInterceptors()
      Initializes the list of server interceptors.
      Returns:
      The list of global server interceptors.
    • sortInterceptors

      public void sortInterceptors(List<? extends ServerInterceptor> interceptors)
      Sorts the given list of interceptors. Use this method if you want to sort custom interceptors. The default implementation will sort them by using a beanDefinitionAwareOrderComparator.
      Parameters:
      interceptors - The interceptors to sort.