Jive Forums API (5.5.20.2-oracle) Developer Javadocs

com.jivesoftware.base.stats
Class HTTPReadStatSession

java.lang.Object
  extended by com.jivesoftware.base.stats.ReadStatSession
      extended by com.jivesoftware.base.stats.HTTPReadStatSession
All Implemented Interfaces:
java.io.Serializable

public class HTTPReadStatSession
extends ReadStatSession
implements java.io.Serializable

Encapsulates a series of HTTP read stat occurrences. Each session has an ID, the date it was created and extra HTTP info (IP, referrer and user agent).

Note, this class is basically a simple bean and does not handle its own persistence. Other classes should persist it to a db or filesystem.

This class has been marked as serializable since it will likely need to be set in the HttpSession.

See Also:
Serialized Form

Constructor Summary
HTTPReadStatSession()
           
HTTPReadStatSession(java.lang.String visitorID, java.util.Date creationDate, java.lang.String referrer, java.lang.String userAgent, java.lang.String ip, java.lang.String country)
          Creates an 'unsaved' session given all parameters but the ID.
HTTPReadStatSession(java.lang.String visitorID, long sessionID, java.util.Date creationDate, java.lang.String referrer, java.lang.String userAgent, java.lang.String ip, java.lang.String country)
          Creates an HTTP session given all parameters.
 
Method Summary
 long getBytesSent()
          Returns the total number of bytes transferred over the lifetime of this session.
 java.lang.String getCountry()
          Returns the code for the country this session is created under (ie, US, UK, DE, FR, etc).
 java.lang.String getIP()
          Returns the IP of the host making the request.
 java.lang.String getReferrer()
          Returns the http referrer for this session.
 java.lang.String getUserAgent()
          Returns the user agent for this session or null if one was not found.
 java.lang.String toString()
          Returns the session in a readable format - good for debugging.
 void updateBytesSent(long newBytesSent)
          Adds to the total number of bytes sent from the server to the client over the life of this session.
 
Methods inherited from class com.jivesoftware.base.stats.ReadStatSession
getCreationDate, getSessionID, getVisitorID, setSessionID
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

HTTPReadStatSession

public HTTPReadStatSession()

HTTPReadStatSession

public HTTPReadStatSession(java.lang.String visitorID,
                           long sessionID,
                           java.util.Date creationDate,
                           java.lang.String referrer,
                           java.lang.String userAgent,
                           java.lang.String ip,
                           java.lang.String country)
Creates an HTTP session given all parameters. This method is protected because it should only be used by a factory method to initialize an instance of this class from persistence.

Parameters:
visitorID - the ID of the visitor.
sessionID - a unique session ID.
creationDate - the date the session was created.
referrer - the referrer for the session or null if it is unknown.
userAgent - the user agent of the session (user agents need only be recorded once per session since they won't change during a session.
ip - the IP address of the requesting host no null if it is unknown.
country - the code of the country this session is created by (ie, US, UK, DE, FR, etc).

HTTPReadStatSession

public HTTPReadStatSession(java.lang.String visitorID,
                           java.util.Date creationDate,
                           java.lang.String referrer,
                           java.lang.String userAgent,
                           java.lang.String ip,
                           java.lang.String country)
Creates an 'unsaved' session given all parameters but the ID. The ID is -1 by default.

Parameters:
visitorID - the ID of the visitor.
creationDate - the date the session was created.
referrer - the referrer for the session or null if it is unknown.
userAgent - the user agent of the session (user agents need only be recorded once per session since they won't change during a session.
ip - the IP address of the requesting host no null if it is unknown.
country - the code of the country this session is created by (ie, US, UK, DE, FR, etc).
Method Detail

getReferrer

public java.lang.String getReferrer()
Returns the http referrer for this session.

Returns:
the http referrer for this session or NULL if it doesn't exist.

getUserAgent

public java.lang.String getUserAgent()
Returns the user agent for this session or null if one was not found.

Returns:
the user agent for this session or null if one was not found.

getIP

public java.lang.String getIP()
Returns the IP of the host making the request.

Returns:
the IP of the host making the request.

getCountry

public java.lang.String getCountry()
Returns the code for the country this session is created under (ie, US, UK, DE, FR, etc). For a more complete description, see the Locale class or http://www.chemie.fu-berlin.de/diverse/doc/ISO_3166.html.

Returns:
the country code of the session or null if it is unknown.

getBytesSent

public long getBytesSent()
Returns the total number of bytes transferred over the lifetime of this session. If the value is -1 then that means no information was collected.

Returns:
the total number of bytes transferred in this session or -1 if no information is available.

updateBytesSent

public void updateBytesSent(long newBytesSent)
Adds to the total number of bytes sent from the server to the client over the life of this session.

Parameters:
newBytesSent - the new amount of bytes sent.

toString

public java.lang.String toString()
Returns the session in a readable format - good for debugging.

Overrides:
toString in class ReadStatSession
Returns:
the session in a readable format - good for debugging.

Jive Forums Project Page

Copyright © 1999-2006 Jive Software.