Java 类io.grpc.ForwardingServerCall 实例源码

项目:grpc-java    文件:SafeMethodCachingInterceptorTest.java   
@Override
public <ReqT, RespT> ServerCall.Listener<ReqT> interceptCall(
    ServerCall<ReqT, RespT> call,
    final Metadata requestHeaders,
    ServerCallHandler<ReqT, RespT> next) {
  return next.startCall(
      new ForwardingServerCall.SimpleForwardingServerCall<ReqT, RespT>(call) {
        @Override
        public void sendHeaders(Metadata headers) {
          for (String cacheControlDirective : cacheControlDirectives) {
            headers.put(CACHE_CONTROL_METADATA_KEY, cacheControlDirective);
          }
          super.sendHeaders(headers);
        }
      },
      requestHeaders);
}