Update of /cvsroot/opensymphony/clickstream/src/com/opensymphony/clickstream
In directory sc8-pr-cvs1:/tmp/cvs-serv15224/clickstream/src/com/opensymphony/clickstream
Modified Files:
Clickstream.java ClickstreamRequest.java
Log Message:
Implemented points 1 and 2 of CLK-9.
Index: Clickstream.java
===================================================================
RCS file: /cvsroot/opensymphony/clickstream/src/com/opensymphony/clickstream/Clickstream.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- Clickstream.java 8 Jun 2002 10:15:17 -0000 1.2
+++ Clickstream.java 2 Sep 2003 09:17:42 -0000 1.3
@@ -6,6 +6,8 @@
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
+import java.util.HashMap;
+import java.util.Map;
/**
* The actual stream of clicks tracked during a user's navigation through a site.
@@ -13,13 +15,14 @@
* @author <a href="[email protected]">Patrick Lightbody</a>
*/
public class Clickstream implements Serializable {
- List clickstream = new ArrayList();
- String hostname;
- HttpSession session;
- String initialReferrer;
- Date start = new Date();
- Date lastRequest = new Date();
- boolean bot = false;
+ private List clickstream = new ArrayList();
+ private Map attributes = new HashMap();
+ private String hostname;
+ private HttpSession session;
+ private String initialReferrer;
+ private Date start = new Date();
+ private Date lastRequest = new Date();
+ private boolean bot = false;
public Clickstream() {
}
@@ -36,22 +39,43 @@
if (hostname == null) {
hostname = request.getRemoteHost();
session = request.getSession();
- }
-
- // if this is the first request in the click stream
+ }
+
+ // if this is the first request in the click stream
if (clickstream.size() == 0) {
- // setup initial referrer
+ // setup initial referrer
if (request.getHeader("REFERER") != null) {
initialReferrer = request.getHeader("REFERER");
} else {
initialReferrer = "";
- }
-
- // decide whether this is a bot
+ }
+
+ // decide whether this is a bot
bot = BotChecker.isBot(request, this);
}
- clickstream.add(new ClickstreamRequest(request));
+ clickstream.add(new ClickstreamRequest(request, lastRequest));
+
+ }
+
+ /**
+ * Gets an attribute for this clickstream.
+ *
+ * @param name
+ * @return
+ */
+ public Object getAttribute(String name) {
+ return attributes.get(name);
+ }
+
+ /**
+ * Sets an attribute for this clickstream.
+ *
+ * @param name
+ * @param value
+ */
+ public void setAttribute(String name, Object value) {
+ attributes.put(name, value);
}
/**
@@ -117,4 +141,5 @@
public List getStream() {
return clickstream;
}
-}
+}
+
Index: ClickstreamRequest.java
===================================================================
RCS file: /cvsroot/opensymphony/clickstream/src/com/opensymphony/clickstream/ClickstreamRequest.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- ClickstreamRequest.java 31 Jul 2003 07:51:28 -0000 1.2
+++ ClickstreamRequest.java 2 Sep 2003 09:17:43 -0000 1.3
@@ -1,6 +1,7 @@
package com.opensymphony.clickstream;
import java.io.Serializable;
+import java.util.Date;
import javax.servlet.http.HttpServletRequest;
@@ -17,14 +18,16 @@
private String requestURI;
private String queryString;
private String remoteUser;
+ private Date timestamp;
- public ClickstreamRequest(HttpServletRequest request) {
+ public ClickstreamRequest(HttpServletRequest request, Date timestamp) {
protocol = request.getProtocol();
serverName = request.getServerName();
serverPort = request.getServerPort();
requestURI = request.getRequestURI();
queryString = request.getQueryString();
remoteUser = request.getRemoteUser();
+ this.timestamp = timestamp;
}
public String getProtocol() {
@@ -49,6 +52,10 @@
public String getRemoteUser() {
return remoteUser;
+ }
+
+ public Date getTimestamp() {
+ return timestamp;
}
/**
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.