BT

New Early adopter or innovator? InfoQ has been working on some new features for you. Learn more

Grails 0.6 Adds Best of Breed Mix From Spring Web Flow and Rich Conversations a la JBoss

| by Shane Witbeck on Sep 14, 2007. Estimated reading time: 1 minute |

Graeme Rocher announced that Grails is moving further away from "its Rails-like beginnings" with this latest release.  Although this release was labeled as 0.6, it's clearly being modest with the amount of work that went into it. Here's the full feature list:

 

  • Joint Groovy/Java Compilation
  • Spring Web Flow Integration
  • Support for Spring scopes to allow scoped services
  • Improved support for REST with automatic XML/JSON marshalling and RESTful URL mappings
  • New Config DSL for configuration not possible by convention
  • Refreshed scaffolding interface and branding
  • Support for Sitemesh inline decorators
  • Controllers can now call tag libraries as methods
  • New GSP tags
  • Massive improvements to speed of start-up time, unit tests and generation tool

Spring Web Flow Integration

Just as Rod Johnson had proposed a new way of defining Spring-managed beans via code rather than the traditional XML markup, Graeme takes a similar approach by defining Spring Web Flow definitions with Groovy:

 

showCart {
    on("checkout").to "enterPersonalDetails"
    on("continueShopping").to "showCatalogue"
 }                                         
 enterPersonalDetails {
  on("submit") {
   def p = new Person(params)
   flow.person = p 
   def e = yes()
   if(p.hasErrors() || !p.validate())return error()    
  }.to "enterShipping"   
  on("return").to "showCart"
  on(Exception).to "handleError"
 }              
 enterShipping  {
  on("back").to "enterPersonalDetails"
  on("submit") {
   def a = new Address(params)                           
   flow.address = a
   if(a.hasErrors() || !a.validate()) return error()    
  }.to "enterPayment"
 }


The above snippet illustrates the concept of defining a unit of work or "conversation", as described in the JBoss Seam framework. Just as in Seam, the "flow" contains conversational state information.

 

Automatic XML/JSON marshalling and RESTful URL mapping

 

While previously using a plug-in for conversions, this release uses:

 

 import grails.converters.*
...

def list = {
    render Book.list() as XML
    // or render Book.list() as JSON
}

Rate this Article

Adoption Stage
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Seam by Martin Gilday

What integration has been added with JBoss Seam? There is no mention of it in the release notes. Here you have a subtitle "Rich Conversion via JBoss Seam" but then only have a code snippet showing content rendering, of XML and JSON. Graeme's blog seems to suggest that Grails' new integration with SWF provides something equivalent to Seam's conversations, not "via". Sorry to be pedantic, but the title just seems misleading (unless I have misunderstood).

Re: Seam [News Item Updated] by Scott Delap

Martin,

You are correct. The news item has been updated to correctly identify that the conversation features are similar to Seam but not implemented using seem. Thank you for the quick observation.

nice work by serge ----

exciting stuff guys, keep up the great work!!

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

3 Discuss

Login to InfoQ to interact with what matters most to you.


Recover your password...

Follow

Follow your favorite topics and editors

Quick overview of most important highlights in the industry and on the site.

Like

More signal, less noise

Build your own feed by choosing topics you want to read about and editors you want to hear from.

Notifications

Stay up-to-date

Set up your notifications and don't miss out on content that matters to you

BT