Package io.grpc.util
Class TransmitStatusRuntimeExceptionInterceptor
- java.lang.Object
-
- io.grpc.util.TransmitStatusRuntimeExceptionInterceptor
-
- All Implemented Interfaces:
ServerInterceptor
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/2189") public final class TransmitStatusRuntimeExceptionInterceptor extends Object implements ServerInterceptor
A class that intercepts uncaught exceptions of typeStatusRuntimeExceptionand handles them by closing theServerCall, and transmitting the exception's status and metadata to the client.Without this interceptor, gRPC will strip all details and close the
ServerCallwith a genericStatus.UNKNOWNcode.Security warning: the
StatusandMetadatamay contain sensitive server-side state information, and generally should not be sent to clients. Only install this interceptor if all clients are trusted.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ServerInterceptorinstance()<ReqT,RespT>
ServerCall.Listener<ReqT>interceptCall(ServerCall<ReqT,RespT> call, Metadata headers, ServerCallHandler<ReqT,RespT> next)
-
-
-
Method Detail
-
instance
public static ServerInterceptor instance()
-
interceptCall
public <ReqT,RespT> ServerCall.Listener<ReqT> interceptCall(ServerCall<ReqT,RespT> call, Metadata headers, ServerCallHandler<ReqT,RespT> next)
Description copied from interface:ServerInterceptorInterceptServerCalldispatch by thenextServerCallHandler. General semantics ofServerCallHandler.startCall(io.grpc.ServerCall<RequestT, ResponseT>, io.grpc.Metadata)apply and the returnedServerCall.Listenermust not benull.If the implementation throws an exception,
callwill be closed with an error. Implementations must not throw an exception if they started processing that may usecallon another thread.- Specified by:
interceptCallin interfaceServerInterceptor- Parameters:
call- object to receive response messagesheaders- which can contain extra call metadata fromClientCall.start(io.grpc.ClientCall.Listener<RespT>, io.grpc.Metadata), e.g. authentication credentials.next- next processor in the interceptor chain- Returns:
- listener for processing incoming messages for
call, nevernull.
-
-