Class RestUtils


public class RestUtils extends Object
  • Field Details

  • Constructor Details

    • RestUtils

      public RestUtils()
  • Method Details

    • decodeQueryString

      public static void decodeQueryString(String s, int fromIndex, Map<String,String> params)
    • decodeComponent

      public static String decodeComponent(String s)
      Decodes a bit of an URL encoded by a browser.

      This is equivalent to calling decodeComponent(String, Charset, boolean) with the UTF-8 charset (recommended to comply with RFC 3986, Section 2).

      s - The string to decode (can be empty).
      The decoded string, or s if there's nothing to decode. If the string to decode is null, returns an empty string.
      IllegalArgumentException - if the string contains a malformed escape sequence.
    • checkCorsSettingForRegex

      public static Pattern checkCorsSettingForRegex(String corsSetting)
      Determine if CORS setting is a regex
      a corresponding Pattern if so and o.w. null.
    • corsSettingAsArray

      public static String[] corsSettingAsArray(String corsSetting)
      Return the CORS setting as an array of origins.
      corsSetting - the CORS allow origin setting as configured by the user; should never pass null, but we check for it anyway.
      an array of origins if set, otherwise null.
    • extractTraceId

      public static Optional<String> extractTraceId(String traceparent)
      Extract the trace id from the specified traceparent string.
      traceparent - The value from the traceparent HTTP header
      The trace id from the traceparent string, or Optional.empty() if it is not present.
      See Also: