Class RestUtils

  • public class RestUtils
    extends java.lang.Object
    • Constructor Summary

      Constructor Description
    • Method Summary

      Modifier and Type Method Description
      static java.util.regex.Pattern checkCorsSettingForRegex​(java.lang.String corsSetting)
      Determine if CORS setting is a regex
      static java.lang.String[] corsSettingAsArray​(java.lang.String corsSetting)
      Return the CORS setting as an array of origins.
      static java.lang.String decodeComponent​(java.lang.String s)
      Decodes a bit of an URL encoded by a browser.
      static void decodeQueryString​(java.lang.String s, int fromIndex, java.util.Map<java.lang.String,​java.lang.String> params)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • RestUtils

        public RestUtils()
    • Method Detail

      • decodeQueryString

        public static void decodeQueryString​(java.lang.String s,
                                             int fromIndex,
                                             java.util.Map<java.lang.String,​java.lang.String> params)
      • decodeComponent

        public static java.lang.String decodeComponent​(java.lang.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.
        java.lang.IllegalArgumentException - if the string contains a malformed escape sequence.
      • checkCorsSettingForRegex

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

        public static java.lang.String[] corsSettingAsArray​(java.lang.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.