Chrysalis

Chrysalis is a Java web development framework. It has a different focus from most Model-View-Controller (MVC) web frameworks. Chrysalis controllers resemble normal Java classes with multiple methods. Client request URLs are mapped to each controller method.

The typical MVC framework is founded on one basic insight: that Java servlets can be treated as an event handler for the submit button of HTML forms. This makes servlets analogous to the controller in the MVC pattern, equivalent to the Listener classes used in Java GUIs. From this insight, the rest of the pattern follows easily (see Struts for the most popular implementation of this approach).

Servlet handles submit button-click

There is another way to treat servlets: as Remote Procedure Calls (RPC). Form values can be considered parameters of a procedure call with the servlet as the procedure being invoked.

Servlet invoked with the parameters id, name and stock

MVC web frameworks often de-emphasize the RPC aspect of servlets to encourage the interpretation of servlets as Controllers. What would happen if you took the opposite approach? The above operation could be mapped to a method like the following.

void saveItem(long id, String name, int stock) ...

Once we perform this mapping successfully, we can follow the standard object-oriented practice of putting related methods into a single class, with instance variables for the data values manipulated by those methods. This makes the controllers less like RPC and more like Distributed Objects.

public class CatalogController extends Controller {
  private Item currentItem;

  void saveItem(long id, String name, int stock) ...

  void removeItem(long id) ...

  // Other methods ...
}

This is the approach taken by Chrysalis. Chrysalis does come full circle back to the MVC pattern, but with a different emphasis than many Java web frameworks.

What Next?

For more on Chrysalis's design philosophy, and why you might want to use this framework, see:

For a longer explanation of the Chrysalis framework, take a look at:

To download Chrysalis, go to:

License

Chrysalis is licensed with a BSD-Style License.