Class CookieUtil

java.lang.Object
be.personify.util.http.CookieUtil

public class CookieUtil extends Object
Class to get and set cookies
Author:
vanderw
  • Constructor Details

    • CookieUtil

      public CookieUtil()
  • Method Details

    • getCookie

      public static jakarta.servlet.http.Cookie getCookie(jakarta.servlet.http.HttpServletRequest request, String name)
      Gets a cookie
      Parameters:
      request - the HttpServletRequest
      name - the name of the cookie
      Returns:
      the cookie
    • getCookieValue

      public static String getCookieValue(jakarta.servlet.http.HttpServletRequest request, String name)
      Returns the value of a cookie if present
      Parameters:
      request - the HttpServletRequest
      name - the name of the cookie
      Returns:
      the value of the cookie with the name specified
    • setCookie

      public static void setCookie(jakarta.servlet.http.HttpServletResponse response, String name, String value, String path, int expirySeconds, boolean secure, String domain)
      Sets a cookie
      Parameters:
      response - the HttpServletResponse
      name - the name of the cookie
      value - the value of the cookie
      path - the patch of the cookie
      expirySeconds - the expiry time of the cookie in seconds
      secure - indicating if it has to be secure
      domain - the domain on which the cookie has to be set