com.atlassian.seraph.util
Class CookieUtils

java.lang.Object
  extended by com.atlassian.seraph.util.CookieUtils

Deprecated. use a CookieHandler, CookieEncoder or CookieDecoder instead.

public class CookieUtils
extends Object

Seraph utility class for dealing with cookies.

Includes code from Jive 1.2.4 (released under the Apache license)


Field Summary
static String COOKIES_TO_SEND
          Deprecated.  
 
Constructor Summary
CookieUtils()
          Deprecated.  
 
Method Summary
static String[] decodePasswordCookie(String cookieVal)
          Deprecated. Since 0.10, use CookieEncoder instead
static String[] decodePasswordCookie(String cookieVal, String encoding)
          Deprecated. Since 0.10, use CookieEncoder instead
static String encodePasswordCookie(String username, String password)
          Deprecated. Since 0.10, use CookieEncoder instead
static String encodePasswordCookie(String username, String password, String encoding)
          Deprecated. Since 0.10, use CookieEncoder instead
static javax.servlet.http.Cookie getCookie(javax.servlet.http.HttpServletRequest request, String name)
          Deprecated. Since 0.10, use CookieHandler instead
static String getCookieValue(javax.servlet.http.HttpServletRequest request, String name)
          Deprecated. Since 0.10, use CookieHandler instead
static void invalidateCookie(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, String cookieName)
          Deprecated. Since 0.10, use CookieHandler instead
static void invalidateCookie(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, String cookieName, String path)
          Deprecated. Since 0.10, use CookieHandler instead
static javax.servlet.http.Cookie setCookie(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, String name, String value, int maxAge, String path)
          Deprecated. Since 0.10, use CookieHandler instead
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COOKIES_TO_SEND

public static final String COOKIES_TO_SEND
Deprecated. 
See Also:
Constant Field Values
Constructor Detail

CookieUtils

public CookieUtils()
Deprecated. 
Method Detail

invalidateCookie

public static void invalidateCookie(javax.servlet.http.HttpServletRequest request,
                                    javax.servlet.http.HttpServletResponse response,
                                    String cookieName,
                                    String path)
Deprecated. Since 0.10, use CookieHandler instead

Invalidate the specified cookie and delete it from the response object.

Parameters:
response - The HttpServletResponse object, known as "response" in a JSP page.
cookieName - The name of the cookie you want to delete.
path - of the path the cookie you want to delete.

invalidateCookie

public static void invalidateCookie(javax.servlet.http.HttpServletRequest request,
                                    javax.servlet.http.HttpServletResponse response,
                                    String cookieName)
Deprecated. Since 0.10, use CookieHandler instead

Invalidate the specified cookie and delete it from the response object. Deletes only cookies mapped against the root "/" path. Otherwise use invalidateCookie(HttpServletRequest, HttpServletResponse, String, String)

Parameters:
response - The HttpServletResponse object, known as "response" in a JSP page.
cookieName - The name of the cookie you want to delete.
See Also:
invalidateCookie(HttpServletRequest, HttpServletResponse, String, String)

getCookie

public static javax.servlet.http.Cookie getCookie(javax.servlet.http.HttpServletRequest request,
                                                  String name)
Deprecated. Since 0.10, use CookieHandler instead

Returns the specified Cookie object, or null if the cookie does not exist.

Parameters:
request - The HttpServletRequest object, known as "request" in a JSP page.
name - the name of the cookie.
Returns:
the Cookie object if it exists, otherwise null.

setCookie

public static javax.servlet.http.Cookie setCookie(javax.servlet.http.HttpServletRequest request,
                                                  javax.servlet.http.HttpServletResponse response,
                                                  String name,
                                                  String value,
                                                  int maxAge,
                                                  String path)
Deprecated. Since 0.10, use CookieHandler instead

Sets a cookie This will also put the cookie in a list of cookies to send with this request's response (so that in case of a redirect occurring down the chain, the first filter will always try to set this cookie again) The cookie secure flag is set if the request is secure.


getCookieValue

public static String getCookieValue(javax.servlet.http.HttpServletRequest request,
                                    String name)
Deprecated. Since 0.10, use CookieHandler instead

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 a JSP page.
name - the name of the cookie
Returns:
the value of the cookie, or null if the cookie does not exist.

encodePasswordCookie

public static String encodePasswordCookie(String username,
                                          String password)
Deprecated. Since 0.10, use CookieEncoder instead

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.
password - The password.
Returns:
String encoding the input parameters, an empty string if one of the arguments equals null.

encodePasswordCookie

public static String encodePasswordCookie(String username,
                                          String password,
                                          String encoding)
Deprecated. Since 0.10, use CookieEncoder instead

Builds a cookie string containing a username and password, using offsets to customise the encoding.

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.
password - The password.
encoding - A String used to customise cookie encoding (only the first 3 characters are used)
Returns:
String encoding the input parameters, an empty string if one of the arguments equals null.

decodePasswordCookie

public static String[] decodePasswordCookie(String cookieVal)
Deprecated. Since 0.10, use CookieEncoder instead

Decodes a cookie string containing a username and password.

Parameters:
cookieVal - The cookie value.
Returns:
String[] containing the username at index 0 and the password at index 1, or { null, null } if cookieVal equals null or the empty string.

decodePasswordCookie

public static String[] decodePasswordCookie(String cookieVal,
                                            String encoding)
Deprecated. Since 0.10, use CookieEncoder instead

Decodes a cookie string containing a username and password.

Parameters:
cookieVal - The cookie value.
encoding - A String used to customise cookie encoding (only the first 3 characters are used) - should be the same string you used to encode the cookie!
Returns:
String[] containing the username at index 0 and the password at index 1, or { null, null } if cookieVal equals null or the empty string.


Copyright © 2013 Atlassian. All Rights Reserved.