Tuesday, 18 July 2006

Dynamic

dy·nam·ic (adjective): Characterized by continuous change, activity, or progress

Well, it looks like my static experiment worked. And so we have static rendering of this blog (now turned off), but on an entirely different site.

Main site.
Entry permalink.
RSS 2 feed.

Looks are deceiving, I'll admit that right away.

  • All the internal URLs still point to blojsom.com, so none of the images are broken. Easily fixed by adding properties for the static domain.
  • Individual entry pages aren't working except for the most recent entry.
  • Only the RSS 2 flavor was selected for static rendering.

Basically what I wanted to accomplish was to be able to render this blog statically, but with the bells and whistles that come with dynamic rendering. This is what I'd like to introduce in the next point release after I finally release blojsom 3.0. So, how does it work?

Using the blojsom event notification and listener API, I simply developed a plugin that listens for entry events and essentially re-creates a "request" that might normally come through the blog and be processed dynamically. So, for example, when an entry is added to the blog, the plugin gets that event and processes it in a pseudo-dynamic fashion for certain flavors marked for static rendering and for the entry itself. Although I haven't worked on handling other events like response (comments, trackbacks, pingbacks) approval or hooking into workflow where events might go through a process of approval before they're published, it's a good first start. A lot of the grunt work has already been done, so I think going forward it's just going to be a matter of establishing some common conventions for static rendering and proceeding.

Basically I was able to re-use all of the code in the plugin from BlojsomServlet with a few extra lines of code to process certain flavors appropriately. Thank goodness for mock objects.

MockHttpServletResponse httpServletResponse = new MockHttpServletResponse();
MockHttpServletRequest httpServletRequest = new MockHttpServletRequest();

This was really the only magic "sauce" that allowed me to process the event using all of the plugins and other components that would normally be executed in a request, which is why you see things such as the technorati tags being added appropriately for the entries. Another nice thing is that you still retain the ability blojsom already has to develop templates in Velocity, JSP, FreeMarker, Groovy, or WebMacro and have those templates used in static rendering.

Anyhoo ... that's all for now. Stay tuned!

Technorati Tags:

Posted by david at 10:36 PM in blojsom ... all blojsom

Static

stat·ic (adjective): Fixed; stationary.

<fingers-crossed/>

Posted by david at 7:49 PM in blojsom ... all blojsom
« First  « Prev   1 2 3 4 5   Next »  Last »
« July »
SunMonTueWedThuFriSat
      1
2345678
9101112131415
16171819202122
23242526272829
3031