|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.isti.util.gui.CookieAccess
public class CookieAccess
Class CookieAccess contains utility methods for writing, reading and deleting browser cookies. Because of write-access limitations in Sun's browser plug-in, the following JavaScript code may be needed in the launching HTML document when using the plug-in for Java support:
<SCRIPT LANGUAGE="JavaScript"><!-- function setCookieValue(valStr) { document.cookie = valStr; } //--></SCRIPT>
Field Summary | |
---|---|
protected JSObject |
browserObj
|
protected boolean |
DEBUG_FLAG
|
protected JSObject |
documentObj
|
Constructor Summary | |
---|---|
CookieAccess(java.applet.Applet appletObj)
Constructs a cookie-access object. |
Method Summary | |
---|---|
static java.lang.String |
decodeString(java.lang.String sourceStr)
Decodes the given string such that all occurrences of characters that are not letters, digits or the underscore character ('_') are changed back from their "%##" codes. |
static java.lang.String |
encodeString(java.lang.String sourceStr)
Encodes the given string such that all occurrences of characters that are not letters, digits or the underscore character ('_') are changed to "%##" codes. |
java.lang.String |
getAllRawCookies()
Returns all the cookies, or null if an error occurs. |
java.lang.String |
getCookie(java.lang.String nameStr)
Reads the data from the given cookie and decodes it out from plain ASCII format (decodes "%##" sequences into characters). |
java.lang.String |
getRawCookie(java.lang.String nameStr)
Returns the cookie, or null if an error occurs. |
static boolean |
isHexDigit(char ch)
Returns true if the given character qualifies as a hexidecimal digit. |
java.lang.String |
removeCookie(java.lang.String name)
Removes the cookie by setting its expiration date in the past. |
java.lang.String |
removeRawCookie(java.lang.String name)
Removes the cookie by setting its expiration date in the past. |
boolean |
setCookie(java.lang.String nameStr,
java.lang.String dataStr,
java.util.Date expireDateObj)
Encodes the name and data into plain ASCII format (using "%##" sequences) and sets the cookie data value and expiration date. |
boolean |
setCookie(java.lang.String nameStr,
java.lang.String dataStr,
java.util.Date expireDateObj,
boolean verifyFlag)
Encodes the name and data into plain ASCII format (using "%##" sequences) and sets the cookie data value and expiration date. |
boolean |
setRawCookie(java.lang.String nameStr,
java.lang.String dataStr,
java.util.Date expireDateObj)
Sets the cookie to the given data value and expiration date. |
boolean |
setRawCookie(java.lang.String nameStr,
java.lang.String dataStr,
java.util.Date expireDateObj,
boolean verifyFlag)
Sets the cookie to the given data value and expiration date. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final boolean DEBUG_FLAG
protected final JSObject browserObj
protected final JSObject documentObj
Constructor Detail |
---|
public CookieAccess(java.applet.Applet appletObj)
appletObj
- applet objectMethod Detail |
---|
public boolean setCookie(java.lang.String nameStr, java.lang.String dataStr, java.util.Date expireDateObj, boolean verifyFlag)
nameStr
- the name for the cookie.dataStr
- the data to save.expireDateObj
- the expiration date for the cookie, or null
for current-session-only cookie.verifyFlag
- if true then the contents of the cookie are read
back for verification with true returned if OK, false if mismatch.
public boolean setCookie(java.lang.String nameStr, java.lang.String dataStr, java.util.Date expireDateObj)
nameStr
- the name for the cookie.dataStr
- the data to save.expireDateObj
- the expiration date for the cookie, or null
for current-session-only cookie.
public java.lang.String getCookie(java.lang.String nameStr)
nameStr
- the name of the cookie to be fetched, which is
encoded into plain ASCII format (using "%##" sequences).
public java.lang.String removeCookie(java.lang.String name)
name
- the name of the cookie to be removed, which is
encoded into plain ASCII format (using "%##" sequences).
public boolean setRawCookie(java.lang.String nameStr, java.lang.String dataStr, java.util.Date expireDateObj, boolean verifyFlag)
nameStr
- the name for the cookie.dataStr
- the data to save.expireDateObj
- the expiration date for the cookie, or null
for current-session-only cookie.verifyFlag
- if true then the contents of the cookie are read
back for verification with true returned if OK, false if mismatch.
public boolean setRawCookie(java.lang.String nameStr, java.lang.String dataStr, java.util.Date expireDateObj)
nameStr
- the name for the cookie.dataStr
- the data to save.expireDateObj
- the expiration date for the cookie, or null
for current-session-only cookie.
public java.lang.String getRawCookie(java.lang.String nameStr)
nameStr
- the name of the cookie to be removed (no encoding
is done to the name).
public java.lang.String getAllRawCookies()
public java.lang.String removeRawCookie(java.lang.String name)
name
- the name of the cookie to be removed (no encoding
is done to the name).
public static java.lang.String encodeString(java.lang.String sourceStr)
sourceStr
- source string
public static java.lang.String decodeString(java.lang.String sourceStr)
sourceStr
- source string
public static boolean isHexDigit(char ch)
ch
- character
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |