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 typeStatusRuntimeException
and 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
ServerCall
with a genericStatus.UNKNOWN
code.Security warning: the
Status
andMetadata
may 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 ServerInterceptor
instance()
<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:ServerInterceptor
InterceptServerCall
dispatch by thenext
ServerCallHandler
. General semantics ofServerCallHandler.startCall(io.grpc.ServerCall<RequestT, ResponseT>, io.grpc.Metadata)
apply and the returnedServerCall.Listener
must not benull
.If the implementation throws an exception,
call
will be closed with an error. Implementations must not throw an exception if they started processing that may usecall
on another thread.- Specified by:
interceptCall
in 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
.
-
-