Class GrpcStatusUtils

java.lang.Object
io.servicetalk.grpc.internal.GrpcStatusUtils

public final class GrpcStatusUtils extends Object
Provides utilities around percent-encoding and decoding the GRPC status message.

Note that much of the actual encoding and decoding logic is borrowed from the io.grpc.Status class, specifically the io.grpc.Status#StatusMessageMarshaller.

  • Field Details

    • GRPC_STATUS_MESSAGE

      public static final CharSequence GRPC_STATUS_MESSAGE
  • Method Details

    • setStatusMessage

      public static void setStatusMessage(HttpHeaders headers, CharSequence message)
      Sets and potentially encodes the given status message.
      Parameters:
      headers - the headers on where to set the message.
      message - the message to set.
    • getStatusMessage

      @Nullable public static CharSequence getStatusMessage(HttpHeaders headers)
      Tries to read the status message from the HttpHeaders and percent-decode if necessary.
      Parameters:
      headers - the headers to load and decode the status message from.
      Returns:
      the decoded status message, or null of no message found in the header provided.