Carmesí 1.0

The first stable version of Carmesí is already available. Carmesí is a web framework based on MVC pattern. I was thinking of a very succinct framework that doesn’t need configuration files,  where the API was minimal and was something like a simple layer above of Servlets. Because I don’t have problems working with HTML, a MVC framework was OK for me.

With this loose idea in mind I started a cycle of design-implementation-testing of the concepts. Near in the beginning, I wondered if it was worth what I was doing, if any of the several web frameworks in Java is already doing something like I wanted to do.  I thought that Spring MVC or Struts could be candidates. As I’ve always fix myself with Servlets, JSP, HTML and javascript, never worked with any of this frameworks so I made a review of both. Struts is a top level abstraction so was very different of my idea. Then when I moved to Spring, I see some similar things. Was there any bonus on doing my own framework? Not an easy or objective question. So I started to look into the differences and was the initial idea that gave me the answer: I didn’t want an extra xml file, extra configuration, I wanted  an simple API.

So, after some months of testing the usability of the API and making sure all the unit test were passing, today I announce the availibity of Carmesí 1.0 .

Carmesí is based in annotations for a declarative approach, Servlet 3.0 for automatic and dynamic registration of the components, and an annotation proccesor for automatic generation of a file (it’s a list of annotated classes).

This is an example of the features:

@URL("/doService")
@ForwardTo("/result.jsp")
public class POJOController {
  @Inject
  private A a;

  @PostConstruct
  public void init(){
    //do init
  }

  @RequestAttribute("value") //this attribute will contain the return value
  public int add(@RequestParameter("a") int a, @RequestParameter("b") int b){
    //do logic
    //return the result
  }

}

The code above is using request parameter injection (and conversion), CDI, url to controller binding, forward to the view result.jsp, and is telling to Carmesí that the result will be in an attribute of the request.

The page of the project is in http://code.google.com/p/carmesi/. The distribution file is here, you just need to include the jar file to start using it (more info the project page). You can find documentation in the Carmesi Guide.

I hope you can give it a try.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s