Discussions

News: A New Open Source, RPC-flavored Web Framework: Chrysalis

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

    Chrysalis takes a URL like this:

    Security.login.cmd?username=Bob&password=secret

    And maps it to a method in a Controller class like this:

    public class SecurityController extends Controller {
        public login(String username, String password) ...
    }


    This gives Chrysalis controllers an RPC-flavor that makes the mapping between URLs and controller methods very straightforward.

    Furthermore, each Chrysalis controller can have multiple methods and share state through its instance variables. Instead of having lots of little actions (LoginAction, LogoutAction, RetrieveUserAction), you can have one controller that handles a set of related use cases:

    public class SecurityController extends Controller {
        private User user;

        public login(String username, String password) throws Exception {
            this.user = LoginSystem.login(username, password);
        }

        public logout() {
            this.user = null;
        }

        public User getUser() {
            return this.user;
        }
    }


    Chrysalis has many useful features:

    * Most of the usual framework features: MVC, configurable view redirection, error handling, form generation custom tags, security (standard or custom), internationalization

    * Hierarchical Configuration: Chrysalis uses a hierarchical configuration mechanism, allowing configuration values to be defined at the class/page level, package/directory level or globally.

    * Sophisticated Client-Side Validation: Chrysalis uses a sophisticated, object-oriented JavaScript validation library. This JavaScript library is also internationalized.

    * Support for Older Containers: Chrysalis functions on older Servlet 2.2 containers. Chrysalis also adds partial support from some of the nicer features of the modern Servlet/JSP API (filters, JSTL Expression Language) that are backwards compatible with these older containers.

    * Out-of-Container Testing: Chrysalis controllers are designed to support of out-of-container testing, so that you can unit test your controllers outside the Servlet engine.

    We realize that the market is glutted with Open Source Java web frameworks, but we think Chrysalis has enough innovative features to make it worthwhile. We have a Quick Start page that summarizes the major features of the framework, and we hope you give it a try.

    http://chrysalis.sourceforge.net

    Chrysalis Quick Start

    NOTE: Other web frameworks can be configured to work similarly to the method described here

    Threaded Messages (24)

  2. Oh god[ Go to top ]

    I swear I'll personally shoot the first one who says "innovation is a good thing".
  3. Oh god[ Go to top ]

    innovation is a ....

    Ahhhh, nevermind.
  4. Oh god[ Go to top ]

    The framwork's description contains the word "MVC" but not "XML"

    With such a keyword missing, this framework as no future. :-)
  5. RE: Oh god[ Go to top ]

    Innovation is a great thing!

    If you don't want to innovate, at least have the decency to not lash out at others who TRY to innovate.
  6. innovation[ Go to top ]

    Machiavelli uses the word 'innovation' (in translation of course) as a _bad_ word. Like conspiracy. Beware Innovations.
  7. Although I'm no expert on MVC's, I've used a few and have found them to be widely ranging in scope and useability.

    I've read through the documentation on Chrysalis, and the only 'new' feature I can see is the fact you define the controller actions methods with the view properties defined as parameters. It's a nice touch that these parameters can be JavaBeans, but it's not like other frameworks can't do this.

    It would have been nice to see some sort of expression language implemented on the view, so that you don't need to specify getters on the controller for all the different domain objects (Tapestry and Webwork both have implementations).

    Also the binding of domain/controller properties to the view's input fields is rather weak... Tapestry seems to provide a much better implementation.

    Fair dos though it does provide a different 'focus' than most of the other MVC's with the RPC-flavour, but is it a better way to do and MVC?
  8. I've read through the documentation on Chrysalis, and the only 'new' feature I can see is the fact you define the controller actions methods with the view properties defined as parameters. It's a nice touch that these parameters can be JavaBeans, but it's not like other frameworks can't do this.


    I agree; such a single new feature doesn't justify a new framework. We recently had "long transaction support" (showing a wait page before a long-processing request returns) as justification for a new web framework. What are we gonna see next?

    Such features can easily be implemented for existing web frameworks, so I really don't see the point in creating a new framework here. I do appreciate different styles of doing things, but a single feature isn't a differentiator for a framework.

    Juergen
  9. I'm disappointed. Only one new framework today?
  10. With so many framework and libraries I would like their authors use the following template on the very first page of documentation or project site:

    1. I(we) had a need to do: <Two phrases to describe>

    2.I(we) have tried the following frameworks: <insert names> before starting to develop my own.

    3.They are supposed to address my needs but I was not happy with them because:
    <reasons, why those frameworks are not satisfactory>

    4. I(we) decided not to contribute in any of existing open source frameworks because: <describe why>
  11. With so many framework and libraries I would like their authors use the following template on the very first page of documentation or project site:

    >
    > 1. I(we) had a need to do: <Two phrases to describe>
    >
    > 2.I(we) have tried the following frameworks: <insert names> before starting to develop my own.
    >
    > 3.They are supposed to address my needs but I was not happy with them because:
    > <reasons, why those frameworks are not satisfactory>
    >
    > 4. I(we) decided not to contribute in any of existing open source frameworks because: <describe why>

    That's actually a good strategy for in-house developments too. Far too many custom frameworks get developed from scratch within companies, typically persistence, web or general application frameworks. Many people simply don't bother with checking out existing solutions first.

    Juergen
  12. Nobody wastes his time without motivation, I think it is very nice to have
    tons of frameworks and innovations. I need some new framework for web applications too ( something without XML's, scriptable more "dynamic" than existing frameworks) Probably I will start to implement it myself :)

    > With so many framework and libraries I would like their authors use the following template on the very first page of documentation or project site:
    >
    > 1. I(we) had a need to do: <Two phrases to describe>
    >
    > 2.I(we) have tried the following frameworks: <insert names> before starting to develop my own.
    >
    > 3.They are supposed to address my needs but I was not happy with them because:
    > <reasons, why those frameworks are not satisfactory>
    >
    > 4. I(we) decided not to contribute in any of existing open source frameworks because: <describe why>
  13. is this innovation[ Go to top ]

    I agree with your suggestion about being careful not to rewrite a framework from scratch. But sometimes a new approach or idea has to be fully prototyped before its core can me introduced in some existing framework. For example the thingy I'm scratching on, just as a finger excercise.

    Below an example for a bugtracker's add-an-issue page (as a testcase).

    <dd:Dialog>

    <dd:LoadSection>

    <%// check if the required parameters are set %>
    <dd:if cond="${ param.productnr == null }">
    <dd:goto href="/issueAddPrep1.dd"/>
    </dd:if>
    <dd:if cond="${ param.version == null }">
    <dd:goto href="/issueAddPrep2.dd"/>
    </dd:if>

    <%// get the product based on the productnr %>
    <dd:call method="org.tbee.bugger.entities.EntityManager.getEntityManager" into="entitymanager"/>
    <dd:call method="entitymanager.findProductByProductnr" param1="${param.productnr}" into="product"/>

    </dd:LoadSection>
    <dd:DialogSection template="default">

    <%// the form %>
    <dd:group id="contentgroup">
    <dd:textfield label="=id" id="productname" value="${product.name}" readonly="yes"/>
    <dd:textfield label="=id" id="version" value="${param.version}" readonly="yes"/>
    <dd:textfield label="descriptionShort" id="title" mandatory="yes"/>
    <dd:textfield label="description" id="comment" mandatory="yes"/>
    <dd:fileupload label="illustration" id="upload" />
    <dd:commandbutton label="=id" id="add" tooltip="AddIssue"/>
    </dd:group>

    </dd:DialogSection>
    <dd:SubmitSection>

    <dd:SubmitTarget target="add">
    <dd:call method="org.tbee.bugger.entities.EntityManager.getEntityManager" into="entitymanager"/>

    <%// find user %>
    <dd:call method="entitymanager.findUserByName" param1="${currentusername}" into="user"/>

    <%// add an issue %>
    <dd:call method="entitymanager.newIssue" into="issue"/>
    <dd:call method="issue.setEnteredby" param1="$null"/>
    <dd:call method="issue.setTitle" param1="${formfield.title}"/>

    <%// add a comment %>
    <dd:call method="entitymanager.newIssuecomment" into="issuecomment"/>
    <dd:call method="issuecomment.setCreatedby" param1="$null"/>
    <dd:call method="issuecomment.setIssuenr" param1="${issue}"/>
    <dd:call method="issuecomment.setComment" param1="${formfield.comment}"/>

    <%// if a file is specified %>
    <dd:if cond="${ param.upload1 != null }">

    <%// add an attachment %>
    <dd:call method="entitymanager.newIssuecommentattachment" into="attachement"/>
    <dd:call method="attachement.setIssuecommentnr" param1="${issuecomment}"/>
    <dd:call method="attachement.setData" param1="${formfield.upload1.bytes}"/>
    <dd:call method="attachement.setContenttype" param1="${formfield.upload1.contenttype}"/>

    </dd:if>

    </dd:SubmitTarget>

    </dd:SubmitSection>
    </dd:Dialog>

    This is all that is needed to code this page (aside from a business model and template that is application-wide), including login, and stylesheets and flexible look and feel and all, oh and the uploaded binary is written to the database. I feel this approach is quite an improvement over the widely dispersed code Struts uses.

    Tom
  14. Replies to comments[ Go to top ]

    Hi folks,

    Thanks for you kind feedback. In answer to some of your suggestions:

    Maturity: I would be the first to admit that Chrysalis is immature. The initial release was only a few months ago. This is the first major piece of publicity for the framework, and I am hoping to garner some interest and commentary on the framework so I can focus on areas that need improvement.

    Motivation: Like a lot of framework developers, I was motivated by the complexity of Struts. At the time I started writing Chrysalis, Struts 1.0 was the only well-known framework, and I had a hard time convincing people (and myself) to use it because of it was so difficult. It was clear that Struts had a major payoff once implemented, but the ramp-up cost was pretty steep. I wanted to produce a more straightforward framework with a shallower learning curve.

    By the time I learned about other frameworks like Tapestry and Webworks (and the Struts 1.1 release), I was far enough along and had enough interesting features that I decided it was worthwhile to complete the framework. (I also had a deeper respect for why Struts is so complicated; any feature-rich framework would be).

    Expression Languages: Chrysalis does have support for an expression language, namely JSTL EL. At the moment, this support is limit to a few tags (<set>, <if>, <elseif> and <print>, because I have a knee-jerk negative reaction to any form of scripting in the view, whether it is Java code or an Expression Language. If there is demand for it, I may expand the EL support and support other expression languages.

    Innovation: I think that Chrysalis has more than one innovative feature, but then, I am biased. :)

    Innovation is a tough-line to walk. I wanted to innovate enough to differentiate Chrysalis from other frameworks, but not be so radically different that no one would understand it or want to use it.

    Still, here are a few more things I think are interesting about the framework:

    Hierarchical Configuration: Chrysalis uses a hierarchical configuration mechanism, allowing configuration values to be defined at the class/page level, package/directory level or globally. For example, see the discussion here:

    http://chrysalis.sourceforge.net/webguide/page-configuration.html

    Or for the gory details, see here:

    http://chrysalis.sourceforge.net/apidocs/org/chwf/config/package-summary.html

    This approach to configuration allows configuration files to be defined on a package-by-package or directory-by-directory basis, so that separate groups of developers can control their own configuration. This should avoid the problem that Struts had to address in version 1.1 by defining separate Struts modules within a single web application context. Better yet, Chrysalis's separated configuration data can be combined into a single global configuration file for production.

    Furthermore, this provides a clean way to define default configuration values. For example, a page template can be defined globally, but still be overridden as needed for individual directories and pages.

    Chrysalis's entire configuration system is internationalized as well, so that configuration values (such as property field labels) can be customized for different locales.

    Client-Side Validation: JavaScript validation is not an afterthought in Chrysalis. In fact, this code is the oldest part of the framework.

    http://chrysalis.sourceforge.net/javascript/

    Chrysalis's form validation library creates an object-oriented wrapper for form data, allowing JavaScript functions to manipulate form fields more cleanly.

    For example, if a form had a "price" field and a "quantity" field, these fields could be manipulated very easily:

    formData.getPrice() * formData.getQuantity();

    If fields are marked as a numeric type, their values are automatically coerced to JavaScript numeric values to that calculations are performed correctly.

    In addition, the JavaScript library is also internationalized.

    Support for Older Containers: One of the nicest and most widely used features of the Servlet 2.3+ API are javax.servlet.Filter classes. Chrysalis adds support for filters on older Servlet 2.2 containers.

    http://chrysalis.sourceforge.net/guide/architecture.html (see Servlet 2.2 Filter Support)

    Although the support is not perfect, it is functional. For people working on older servers, this feature alone might be worth the price of admission.

    Feature Independence: All of the features discussed above are independent of the framework as a whole. Since it is still early in the life of Chrysalis, I am not sure what people will eventually be interested in, so I decided to make each subsystem self-contained.

    Even if you don't like the framework as a whole, the Configuration API, JavaScript library and Servlet 2.2 Filter Support might be worth a look.
  15. Just a quick comment[ Go to top ]

    Hi Paul,

    I don't really consider JSTL EL as an expression language in the form it is used here. Although it allows 'view logic' to be implemented, it doesn't allow any navigation of the object model.

    Webwork has it's own expression language, and Webwork 2 uses OGNL, as does Tapestry. These implementations allow you to browse the domain model from within the view, allowing you to easily iterate through collections and access objects contained by a domain object without having to expose it as part of the controller. In brief they simplify the controller/action immensely.

    Perhaps the future of Chrysalis will contain some form of object navigation?
  16. Security?[ Go to top ]

    How secure is this? Accessing methods using the url is very extensible, but is it also possible to define securityrules in the xml config file? For Example, to access com.company.Product.addToChart, the user must be logged in?
  17. Web Frameworks with Eclipse[ Go to top ]

    It is very nice to have a lot of choices in Open Source Web Framework. IMO the future will be that those Open Source Web Frameworks will base their development on the Eclipse Web Tools Platform:

    "IBM will contribute a complete set of basic J2EE and Web tools to the eclipse Web Tools Platform project. The contributed tools are the results of significant development effort over several years within the context of the IBM WebSphere Studio product family. These tools are immediately useful in themselves but also provide a framework that runtime vendors and tools developers can extend in the future. These tools will make a significant contributition to the completeness and appeal of the eclipse platform and will help build a thriving J2EE developer community around eclipse."

    More info with nice screenshots on this topic:
    http://www.cs.huji.ac.il/~dar/wdt/ibm.html

    It will be a very excellent situation to have a lot of Open Source Web Frameworks which extend the Eclipse Web Tools Platform! You can make your choice or mixed every Web Frameworks depends on what you need to solve! Great future!

    Cheers,
    Lofi.
  18. Eclipse Web Tools Platform project shows that the Fondation-Consortorium concept is far superior to "ordinary" Open-Source projects.

    But Lofi! Do you really approve of a project to make J2EE as easy as VB programming? :)

    Regards
    Rolf Tollerud
  19. Eclipse Web Tools Platform project shows that the Fondation-Consortorium concept is far superior to "ordinary" Open-Source projects.


    Again, don't mix apples and oranges here: A tools platform is not the same as a web framework. Same as with EJB: There's EJB containers and there's EJB support in various IDEs. No EJB container is built on the EJB support of a specific IDE, so why should a web framework be built on a specific IDE tool platform?

    Many of the features that IBM wants to contribute to Eclipse have been available in IDEA and NetBeans for quite a while. This is completely orthogonal to web frameworks. Of course, some web frameworks might lend themselves better to tools support, particularly if they're designed to be used with tools (like JSF).

    Juergen
  20. Spring for Eclipse?[ Go to top ]

    Hi Juergen!

    Are you planning to build a Spring extension for Eclipse?

    Regards
    Rolf Tollerud
  21. Spring for Eclipse?[ Go to top ]

    Hi Rolf,

    Have you survived your recent Spring weekend in good condition? ;-)

    > Are you planning to build a Spring extension for Eclipse?

    Actually, we already have a beta version of an Eclipse plugin that helps in creating and validating XML bean definition files. Torsten Juergeleit currently maintains it at http://springui.sourceforge.net, but we're in the process of migrating it to our main CVS (as separate module).

    Of course, XML bean definitions can be written with any decent XML editor, for example the one integrated in IntelliJ IDEA. What the Eclipse plugin adds is validating the class names and property names that you refer to in the bean definitions, to catch definition errors at development time instead of run time.

    Juergen
  22. Juergen!

    My apologies for not having said anything about Spring yet (just not finished)! But I will I promise. I am looking into it with the eyes of how it can be integrated with .NET and C#.

    Regards
    Rolf Tollerud
  23. chrysalis RPC style Framework[ Go to top ]

    Hmm.. actually i personally think that this framework may be useful for ajax style of web programming.
  24. Web Frameworks with Eclipse[ Go to top ]

    Lofi, what IBM suggests here is a tool platform for web development, mostly for standard web app management and Servlet/JSP/taglib development. I don't see how a web framework can be "based on" or "extend" that Eclipse web tools platform. There might be add-on tools that validate a specific web framework's configuration file within Eclipse, but that's it.

    So I really don't see your point: The core web frameworks will stay completely unaffected by any tools platform, be it Eclipse, NetBeans, or whatever. You might have noticed that there are other popular IDEs around; the world does not center around Eclipse. So it's very important to keep the frameworks as they are, and just build add-on tools if various IDEs (if that makes sense).

    Juergen
  25. More answers[ Go to top ]

    Security [to Kees van Dieren]: Chrysalis does not allow you to invoke an arbitrary method of any class, only controller classes. Chrysalis also allows you to assign user roles to controller methods and view pages. Users cannot access the method/view unless (a) they are logged in and (b) they belong to that role.

    By default, Chrysalis roles are derived from J2EE-standard security user roles; Chrysalis also allows you to define custom Security plugins to allow you to implement your own Security model.

    Chrysalis's hierarchical configuration allows you to assign roles globally (to a whole Controller package or all view pages), making it easy to secure the entire application. In addition, unlike J2EE, Chrysalis allows you to remove roles, so it is simple to say "secure everything but the login page".

    For details, see:

    http://chrysalis.sourceforge.net/guide/error-handling-and-security.html

    Alternate Scripting [to Stuart Ervine]: At the moment, Chrysalis has only one touch point between it and JSTL EL. It should be relatively easy to support other expression languages, as needed. I have been considering implementing a solution similar to the early days of JSTL, allowing you to choose your own scripting language.

    IDE: Maybe someday. I agree with the other posters here that frameworks should be able to function separately from development tools. Once Chrysalis matures, I plan on produce tools to streamline the development process, starting with XDoclet-ish command line tools to generate XML configurations.