| java.lang.Object org.nemesis.forum.util.CookieManager
CookieManager | public class CookieManager (Code) | | author: dlaurent author: :TODO:passer en config |
Method Summary | |
public static String[] | decodePasswordCookie(String cookieVal) Unrafels a cookie string containing a username and password.
Parameters: value - The cookie value. | public static String | encodePasswordCookie(String username, String password) Builds a cookie string containing a username and password.
Note: with open source this is not really secure, but it prevents users
from snooping the cookie file of others and by changing the XOR mask and
character offsets, you can easily tweak results.
Parameters: username - The username. Parameters: password - The password. | public static Cookie | getCookie(HttpServletRequest request, String name) Returns the specified Cookie object, or null if the cookie does not exist.
Parameters: request - The HttpServletRequest object, known as "request" in aJSP page. Parameters: name - the name of the cookie. | public static String | getCookieValue(HttpServletRequest request, String name) Returns the value of the specified cookie as a String. | public static void | invalidateCookie(HttpServletRequest request, HttpServletResponse response, String cookieName) Invalidate the specified cookie and delete it from the response object. | public static void | setCookie(HttpServletResponse res, String name, String value, int maxAge) |
MAX_COOKIE_AGE | final public static int MAX_COOKIE_AGE(Code) | | |
decodePasswordCookie | public static String[] decodePasswordCookie(String cookieVal)(Code) | | Unrafels a cookie string containing a username and password.
Parameters: value - The cookie value. String[] containing the username at index 0 and the password atindex 1, or { null, null } if cookieVal equalsnull or the empty string. |
encodePasswordCookie | public static String encodePasswordCookie(String username, String password)(Code) | | Builds a cookie string containing a username and password.
Note: with open source this is not really secure, but it prevents users
from snooping the cookie file of others and by changing the XOR mask and
character offsets, you can easily tweak results.
Parameters: username - The username. Parameters: password - The password. String encoding the input parameters, an empty string if one ofthe arguments equals null . |
getCookie | public static Cookie getCookie(HttpServletRequest request, String name)(Code) | | Returns the specified Cookie object, or null if the cookie does not exist.
Parameters: request - The HttpServletRequest object, known as "request" in aJSP page. Parameters: name - the name of the cookie. the Cookie object if it exists, otherwise null. |
getCookieValue | public static String getCookieValue(HttpServletRequest request, String name)(Code) | | Returns the value of the specified cookie as a String. If the cookie
does not exist, the method returns null.
Parameters: request - the HttpServletRequest object, known as "request" in aJSP page. Parameters: name - the name of the cookie the value of the cookie, or null if the cookie does not exist. |
invalidateCookie | public static void invalidateCookie(HttpServletRequest request, HttpServletResponse response, String cookieName)(Code) | | Invalidate the specified cookie and delete it from the response object.
Parameters: request - The HttpServletRequest object, known as "request" in a JSP page. Parameters: response - The HttpServletResponse object, known as "response" in a JSP page. Parameters: cookieName - The name of the cookie you want to delete. |
|
|