Jive Forums API (5.5.20.2-oracle) Developer Javadocs

com.jivesoftware.base.stats
Class WebContext

java.lang.Object
  extended by com.jivesoftware.base.stats.WebContext

public class WebContext
extends java.lang.Object

Encapsulates the request/response objects as well as logic to get and set anonymous guest IDs and retreving of the read stats session object.

This class assumes HttpServletRequest/Response objects, not ServletRequest/Response because HttpSessions and Cookies are used.


Field Summary
static java.lang.String VISITOR_COOKIE_KEY
          Cookie name for anonymous visitor IDs.
static java.lang.String VISITOR_SESSION_KEY
          Session attribute name for anonymous visitor IDs.
 
Constructor Summary
WebContext(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response)
          Creates a new web context based on values in the request and response.
 
Method Summary
static java.lang.String createVisitorID(javax.servlet.http.HttpServletRequest request)
          Creates a new visitor ID based on information in the HttpServletRequest.
 ReadStatSession getReadStatSession()
          Returns the read stat session instance associated with this web context.
 javax.servlet.http.HttpServletRequest getRequest()
          Returns the web request.
 javax.servlet.http.HttpServletResponse getResponse()
          Returns the web response.
 java.lang.String getVisitorID()
          Returns an anonymous visitor ID.
static boolean isValidVisitorID(java.lang.String id)
          Verifies the visitor ID is of the form: IP:RAND.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VISITOR_COOKIE_KEY

public static final java.lang.String VISITOR_COOKIE_KEY
Cookie name for anonymous visitor IDs.

See Also:
Constant Field Values

VISITOR_SESSION_KEY

public static final java.lang.String VISITOR_SESSION_KEY
Session attribute name for anonymous visitor IDs.

See Also:
Constant Field Values
Constructor Detail

WebContext

public WebContext(javax.servlet.ServletRequest request,
                  javax.servlet.ServletResponse response)
Creates a new web context based on values in the request and response.

Parameters:
request - the HttpServletRequest object.
response - the HttpServletResponse object
Method Detail

getRequest

public javax.servlet.http.HttpServletRequest getRequest()
Returns the web request.

Returns:
the web request.

getResponse

public javax.servlet.http.HttpServletResponse getResponse()
Returns the web response.

Returns:
the web response.

getVisitorID

public java.lang.String getVisitorID()
Returns an anonymous visitor ID.

Returns:
an anonymous visitor ID.

getReadStatSession

public ReadStatSession getReadStatSession()
Returns the read stat session instance associated with this web context.

Returns:
a ReadStatSession instance associated with this web context.

createVisitorID

public static java.lang.String createVisitorID(javax.servlet.http.HttpServletRequest request)
Creates a new visitor ID based on information in the HttpServletRequest. A visitor ID will be the remote IP plus some random text.

Parameters:
request - an HttpServletRequest instance
Returns:
a new visitor ID based on information in the HttpServletRequest.

isValidVisitorID

public static boolean isValidVisitorID(java.lang.String id)
Verifies the visitor ID is of the form: IP:RAND.

Parameters:
id - the visitor ID to test.
Returns:
true if the given visitor ID is valid, false otherwise.

Jive Forums Project Page

Copyright © 1999-2006 Jive Software.