Class CookieTool

java.lang.Object
io.datarouter.auth.util.CookieTool

public class CookieTool extends Object
  • Constructor Details

    • CookieTool

      public CookieTool()
  • Method Details

    • addCookie

      public static void addCookie(javax.servlet.http.HttpServletResponse response, String cookieName, String value, String path, int maxAgeSeconds)
    • addCookie

      public static void addCookie(javax.servlet.http.HttpServletResponse response, String cookieName, String value, String path, long maxAgeSeconds)
    • addCookie

      public static void addCookie(javax.servlet.http.HttpServletResponse response, String cookieName, String value, String path, long maxAgeSeconds, boolean sameSiteNone)
    • addCookieSameSiteNone

      public static void addCookieSameSiteNone(javax.servlet.http.HttpServletResponse response, String cookieName, String value, String path, long maxAgeSeconds)
    • getCookieValue

      public static String getCookieValue(javax.servlet.http.HttpServletRequest request, String cookieName)
    • getCookieValue

      public static String getCookieValue(javax.servlet.http.Cookie[] cookies, String cookieName, String defaultValue)
    • getCookieBoolean

      public static Boolean getCookieBoolean(javax.servlet.http.Cookie[] cookies, String cookieName)
    • getCookieBooleanDefault

      public static Boolean getCookieBooleanDefault(javax.servlet.http.Cookie[] cookies, String cookieName, Boolean defaultValue)
    • escapeCookieCharacters

      public static String escapeCookieCharacters(String value)
    • unescapeCookieCharacters

      public static String unescapeCookieCharacters(String value)
    • getCookie

      public static javax.servlet.http.Cookie getCookie(javax.servlet.http.Cookie[] cookies, String cookieName)
    • getFormattedCookie

      public static Optional<String> getFormattedCookie(javax.servlet.http.Cookie[] cookies, String cookieName, String regex, String replacement)
    • deleteCookie

      public static void deleteCookie(javax.servlet.http.HttpServletResponse response, String cookieName)
    • getMapFromString

      public static Map<String,String> getMapFromString(String string, String entrySeperator, String keyValueSeparator)
      Build a map from the string with the format " key[keyValueSeparator]value[entrySeperator]key[keyValueSeparator]value..."
      Parameters:
      string - The input String
      entrySeperator - The separator between tow entries
      keyValueSeparator - The separator between the key and the value
      Returns:
      a Map