java.lang.Object
io.helidon.grpc.core.GrpcHelper
Helper methods for common gRPC tasks.
-
Method Summary
Modifier and TypeMethodDescriptionstatic Throwable
ensureStatusException
(Throwable thrown, io.grpc.Status status) static io.grpc.StatusRuntimeException
ensureStatusRuntimeException
(Throwable thrown, io.grpc.Status status) Ensure that aThrowable
is aStatusRuntimeException
.static String
extractMethodName
(String fullMethodName) Extract the gRPC method name from a method full name.static String
extractNamePrefix
(String fullMethodName) Extract the name prefix from from a method full name.static String
extractServiceName
(String fullMethodName) Extract the gRPC service name from a method full name.static Http.ResponseStatus
toHttpResponseStatus
(io.grpc.Status status) Convert a gRPCStatus
to aHttp.ResponseStatus
.static Http.ResponseStatus
toHttpResponseStatus
(io.grpc.StatusException ex) Convert a gRPCStatusException
to aHttp.ResponseStatus
.static Http.ResponseStatus
toHttpResponseStatus
(io.grpc.StatusRuntimeException ex) Convert a gRPCStatusRuntimeException
to aHttp.ResponseStatus
.
-
Method Details
-
extractServiceName
Extract the gRPC service name from a method full name.- Parameters:
fullMethodName
- the gRPC method full name- Returns:
- the service name extracted from the full name
-
extractNamePrefix
Extract the name prefix from from a method full name.The prefix is everything upto the but not including the last '/' character in the full name.
- Parameters:
fullMethodName
- the gRPC method full name- Returns:
- the name prefix extracted from the full name
-
extractMethodName
Extract the gRPC method name from a method full name.- Parameters:
fullMethodName
- the gRPC method full name- Returns:
- the method name extracted from the full name
-
toHttpResponseStatus
Convert a gRPCStatusException
to aHttp.ResponseStatus
.- Parameters:
ex
- the gRPCStatusException
to convert- Returns:
- the gRPC
StatusException
converted to aHttp.ResponseStatus
-
toHttpResponseStatus
Convert a gRPCStatusRuntimeException
to aHttp.ResponseStatus
.- Parameters:
ex
- the gRPCStatusRuntimeException
to convert- Returns:
- the gRPC
StatusRuntimeException
converted to aHttp.ResponseStatus
-
toHttpResponseStatus
Convert a gRPCStatus
to aHttp.ResponseStatus
.- Parameters:
status
- the gRPCStatus
to convert- Returns:
- the gRPC
Status
converted to aHttp.ResponseStatus
-
ensureStatusException
-
ensureStatusRuntimeException
public static io.grpc.StatusRuntimeException ensureStatusRuntimeException(Throwable thrown, io.grpc.Status status) Ensure that aThrowable
is aStatusRuntimeException
.
-