Thursday, July 31, 2008

Servlet 3.0 - A comprehensive study and example

Servlet 3.0 is an overhaul to the ageing servlet technology. The features I liked in the servlet 3.0 are:
- Making web.xml optional, I really dislike handling 'BOILER PLATE' XML while coding. By using declarative style of programming(To java 5/6/7 people this is pretty old now) it is much easier and fun writing a servlet - bootstrappers will like it much. I will just show you one code snippet using servlet 3.0 that just works.

package org.objectengineering.exp.servlet3;
import javax.servlet.http.annotation.*;


@Servlet(urlMappings={"/foo"})
public class MyFirstServlet3 {
}

Thats it. Try it on a servlet 3.0 capable container like jetty 7.0. While writing this post the latest jetty was 7.0.0-pre1. Your servlet writing is over - can't believe ;) - go and deploy it now - you can skip the web.xml part. done.

Greg Wilkins proposal for asynchronous servlet is interesting and I am looking for its adoption by JSR expert commitee. The proposal can be found at http://dist.codehaus.org/jetty/misc/AsyncServlet3.0-draft0.html.

Saturday, July 12, 2008

Spring Integration: the new kid on the block (of ESB?!!)

I just started exploring Spring Intrgration just day after it was released - the version 1.0.0.M5. Here I will share my first impression with Spring Integration followed by subsequent trials and experimentations. Enforcement for speration of concerns without being intrusive is something at the core of Spring philosophy and it is further extended in Spring Integration. Not to be vary theoritical but to communicate some important points about Spring Integration - I am directly copying some excerpts from officila Spring Integration reference; those are goals and principles of Spring Integration.

Goals:
• Provide a simple model for implementing complex enterprise integration solutions.
• Facilitate asynchronous, message-driven behavior within a Spring-based application.
• Promote intuitive, incremental adoption for existing Spring users.

principles:
• Components should be loosely coupled for modularity and testability.
• The framework should enforce separation of concerns between business logic and integration logic.
• Extension points should be abstract in nature but within well-defined boundaries to promote reuse and portability.