My first public Java app

For the last decade or so I’ve been writing Java apps for someone else. You know, the daily grind in the corporate world. Well I finally got one built and deployed purely for my own reasons.

This particular app started out as something else, an aggregator site meant just for bloggers, but the business model just never materialized. That particular app is still on the back burner, but a few days ago I got the idea to do another kind of aggregator and I was able to use the underlying framework.

The Architecture

The underlying architecture is a bit overdone for this particular need, but since it was already built, it suited me just fine. It uses Stripes for the controller, Rome for the RSS/Atom feed parsing, OSCache for JSP caching, urlrewritefilter for, well, URL rewriting and plain old JSP for the front end (gasp!).

Controller

I’ve liked Stripes for quite some time and it’s simple action-based controllers are very easy to use, much like other frameworks. For this particular application I’m not using any of the JSP tags, just the controller piece. I even went so far as to make everything point to an action and enforce that by having all JSPs under the WEB-INF folder. Maybe overkill, but hey I know no one can hit a JSP manually right?

RSS / Atom Feeds

I started out using Rome for the feed parsing because it seemed the most popular library out there. It turns out to be a real pain in the ass to use. One of the things that is almost over-object oriented. It would be nice to have a simple abstraction over both RSS and Atom and not have to determine which feed you are receiving, supply some parameter to get the content out, etc. Just make it easy. Oh well, it works.

Caching

I went with OSCache solely because of the JSP tags for caching content. This was a cheap way to go, especially considering how I’m grabbing the data out (see below). To determine if the cache needs updating, I execute a simple query to see if any new posts have been entered and use the JSP tag for flushing the cache. Each page is cached as it is encountered.

URL rewriting

I just love this little library. It is a filter that is configured using a simple XML file (no surprise) and does all of my forwards as needed to the appropriate actions. In this application the use is pretty simplistic and I could have made the URLs cleaner than I did, and I still might do so for getting some search engine love.

I’ve used this library on other applications with more complex rewrite rules and it works beautifully.

JSP

Here is the shocker. I’m actually using the JSP SQL tags for getting my content out. If you haven’t fallen out of your chair just yet, let me explain. I could (should?) have gone with a domain model, or even used hibernate (puke) or something else but why? My query requirements were pretty damn simple for this thing and I’m not afraid of SQL, so I used SQL. Pure and simple. I have a total of two queries for the whole thing so there was no need to get fancy. One query to get the content itself (which gets cached remember) and the second to see if the cache needs flushing. OK, the two queries are just for the front end piece. There are a couple more that actually put the content into the database but even there SQL was just easier.

Adding updated content

The content gets updated on a schedule that I can control via another action. I use the concurrent libraries in JDK1.5 to schedule a process that goes out and grabs the feeds (via ROME), and updates the database as needed. I can start and stop the process and change the interval as well.

Next Steps

The site needs some visual work to say the least. I rushed through the header graphic and put the site up just to get it up and running. I have a few other odds and ends to do, but otherwise it is running fairly well.

The site? oh yea, it is CelebrityBlender.com :)



Don’t miss anything, subscribe!

Did you enjoy this post? Why not leave a comment below and continue the conversation, or subscribe to my feed and get articles like this delivered automatically to your feed reader.

Comments

[...] launched the site last week and wrote about the design an technology behind the site in my other blog. Due to that blog I’ve gotten a couple hundred visitors to the site and Google has finally [...]

Leave a comment

(required)

(required)