java.lang.Object
org.gcube.informationsystem.resourceregistry.http.headers.warning.WarningHeaderValue

public final class WarningHeaderValue extends Object
Shared constants and utilities for X-Warning header values.
Author:
Luca Frosini (ISTI - CNR)
  • Field Details

  • Method Details

    • encodeToken

      public static String encodeToken(String value)
      Percent-encodes a header token using UTF-8 bytes.

      Unreserved characters from RFC 3986 (ALPHA / DIGIT / - . _ ~) are preserved as-is; all other bytes are encoded as %HH.

      Parameters:
      value - the raw string token to encode
      Returns:
      the percent-encoded token string
    • format

      public static String format(String warnText)
      Formats warning text into the canonical header value: <warn-code> <warn-agent> "<warn-text>".
      Parameters:
      warnText - the text of the warning
      Returns:
      the formatted warning header value string
    • extractWarnText

      public static String extractWarnText(String headerValue)
      Extracts <warn-text> from a formatted warning header value. Returns empty string when the input is malformed.
      Parameters:
      headerValue - the raw formatted warning header value
      Returns:
      the extracted warning text string, or empty string if malformed