@ExperimentalApi(value="https://github.com/grpc/grpc-java/issues/2189") public final class TransmitStatusRuntimeExceptionInterceptor extends Object implements ServerInterceptor
StatusRuntimeException
and handles
them by closing the ServerCall
, 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 generic Status.UNKNOWN
code.
Security warning: the Status
and Metadata
may contain sensitive server-side
state information, and generally should not be sent to clients. Only install this interceptor
if all clients are trusted.
Modifier and Type | Method and Description |
---|---|
static ServerInterceptor |
instance() |
<ReqT,RespT> |
interceptCall(ServerCall<ReqT,RespT> call,
Metadata headers,
ServerCallHandler<ReqT,RespT> next)
|
public static ServerInterceptor instance()
public <ReqT,RespT> ServerCall.Listener<ReqT> interceptCall(ServerCall<ReqT,RespT> call, Metadata headers, ServerCallHandler<ReqT,RespT> next)
ServerInterceptor
ServerCall
dispatch by the next
ServerCallHandler
. General
semantics of ServerCallHandler.startCall(io.grpc.ServerCall<RequestT, ResponseT>, io.grpc.Metadata)
apply and the returned
ServerCall.Listener
must not be null
.
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 use call
on another thread.
interceptCall
in interface ServerInterceptor
call
- object to receive response messagesheaders
- which can contain extra call metadata from ClientCall.start(io.grpc.ClientCall.Listener<RespT>, io.grpc.Metadata)
,
e.g. authentication credentials.next
- next processor in the interceptor chaincall
, never null
.