Package com.saperion.ngc.util
Class CookieUtil
java.lang.Object
com.saperion.ngc.util.CookieUtil
Utility class to store and read from cookies.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic String
getCookieContent
(String cookieName) Reads from a cookie.static String
Reads the last active Locale from a cookie.static AuthenticationInformation
Reads the last active user from a cookie.static void
Sets a new cookie.static void
storeLastLocale
(String locale) Stores a cookie with information about the last active user Locale.static void
Stores a cookie with information about the last active user.
-
Field Details
-
SA_WEB_CLIENT_LAST_USER
Name of the user-cookie.- See Also:
-
SA_WEB_CLIENT_LAST_USER_LANGUAGE
Name of the user-language-cookie.- See Also:
-
-
Method Details
-
setCookie
Sets a new cookie.- Parameters:
name
- cookie namecontent
- cookie contentmaxAge
- maximum age of this cookie in seconds
-
getCookieContent
Reads from a cookie.- Parameters:
cookieName
- name of the cookie to read from- Returns:
- cookie content as string or null, if no cookie with the specified name was found
-
storeLastUser
public static void storeLastUser()Stores a cookie with information about the last active user. The cookie contains a string like 'Username;Mandant;Type'. -
getLastLoginFromCookie
Reads the last active user from a cookie. Will NOT retrieve the password.- Returns:
- last user or null if cookie was not found or contains invalid content
-
storeLastLocale
Stores a cookie with information about the last active user Locale. The cookie contains a string like 'Locale'.- Parameters:
locale
- like de_DE or en_US
-
getLastLocaleFromCookie
Reads the last active Locale from a cookie.- Returns:
- last locale or null if cookie was not found or contains invalid content
-