com.arsdigita.acs
Class ClientIdentification

java.lang.Object
  |
  +--com.arsdigita.acs.ClientIdentification

public class ClientIdentification
extends Object

Class for working with the client identification cookies (browser_id, session_id, last_hit, etc.) Normally this object will be initialized by the Request Processor and stored as the "client_identification" attribute for the current request.

See Also:
RequestProcessor

Constructor Summary
ClientIdentification(HttpServletRequest req, HttpServletResponse resp)
          Initializes the client identification information from the ad_browser_id and ad_session_id cookies.
 
Method Summary
 void assignBrowserId()
          Generates and assigns browser ID cookie.
 void assignSessionId()
          Generates and assigns the session ID cookie.
static int getCookieReissue()
          Returns the period, in seconds, after which we should reissue the session_id cookie and update last_hit in the sessions table.
static int getSessionTimeout()
          Returns the timeout, in seconds, for sessions.
 long getTime()
          # of seconds since Jan 1.
 boolean isBrowserIdValid()
           
 boolean isSessionIdValid()
           
 void maybeUpdateLastHit()
          This updates the session ID cookie w/ a new last update value if it has been longer than the timeout since the last time it was updated.
 String toString()
          Get debugging string.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ClientIdentification

public ClientIdentification(HttpServletRequest req,
                            HttpServletResponse resp)
Initializes the client identification information from the ad_browser_id and ad_session_id cookies.
Method Detail

isBrowserIdValid

public boolean isBrowserIdValid()
Returns:
True if browser ID exists and is a number.

isSessionIdValid

public boolean isSessionIdValid()
Returns:
True if SessionId exists, is a number, and lastIssue is within the timeout range.

assignSessionId

public void assignSessionId()
                     throws SQLException,
                            ACSException
Generates and assigns the session ID cookie. Will also call the secure token function if using SSL.

assignBrowserId

public void assignBrowserId()
                     throws SQLException,
                            ACSException
Generates and assigns browser ID cookie.

getTime

public long getTime()
# of seconds since Jan 1. 1970, same as the TCL version.

maybeUpdateLastHit

public void maybeUpdateLastHit()
                        throws SQLException
This updates the session ID cookie w/ a new last update value if it has been longer than the timeout since the last time it was updated.

getSessionTimeout

public static int getSessionTimeout()
Returns the timeout, in seconds, for sessions.

getCookieReissue

public static int getCookieReissue()
Returns the period, in seconds, after which we should reissue the session_id cookie and update last_hit in the sessions table.

toString

public String toString()
Get debugging string.
Overrides:
toString in class Object