Cleaning up my Referrers

I'm taking a look at my referrers now. I added a link above earlier in the week with the simplest functionality possible. Everytime I get a request for a page, I check the referrer heading and add it to a Set. If it's already there, it doesn't get repeated, if not it gets added in.

The problem with this is that the bozos at Sun when designing Collections didn't think it was important to get the data out of a Set or Hash in the same order as you put it in. When it says in the JavaDocs that a HashSet "does not guarantee that the order will remain constant over time" they're not kidding. Every other time I check my referrers, they've been moved around or new links have been added randomly in the middle. Sun has fixed this in JDK 1.4, but I've come realize that in fact I'm using 1.3 on my server, so it's either live with what I've got, go get one of the Collections libraries that are floating out there, or hack a fix together myself.

The best thing about my code for this site is that it's all self contained. There's no extra classes to rely on, just Java. I like this level of simplicity. It makes the code VERY portable. So I've got to figure out what I'm going to do with the tools at hand.

First, there's several pieces of information that I want to gather. The URL of the referrer, the time of the last access, and how many times it's been accessed over all. And hell, I'd like a total "links for today" like some of the cool blogs out there like Roller.

Using just hashes, sets and trees this is going to be a bitch to do, so I may have to write my own class and pop it up on the server, but I'm going to see what I can hack together first.

But we rented some movies tonight, so I'm going to have to do that after...

-Russ

< Previous         Next >