Grails 1.0-RC2 Release Notes
3rd of December 2007
The Grails development team has reached another milestone and is pleased to announce the release of version 1.0-RC2 of the Grails web-application development framework.
Grails is a dynamic web-application framework built in Java and Groovy, leveraging best of breed APIs from the Java EE sphere including Spring, Hibernate and SiteMesh. Grails brings to Java and Groovy developers the joys of convention-based rapid development while allowing them to leverage their existing knowledge and capitalize on the proven and performant APIs Java developers have been using for years.
Thank you to all the team members, patch contributors and users. A lot of hard work has gone into this release - we hope you enjoy using this latest installment of the Grails adventure.
Improvements
- 140+ Bug fixes and improvements
- Brand new Reference Documentation
- Now shipping with Spring 2.5
- Support for Content Negotiation for REST
- Automatic JSON and XML Unmarshalling for REST
- Support for foreign key and join table mappings with the ORM DSL
New Features
Content Negotation
Grails now supports content negotiation via the Accept/Content-Type HTTP headers, a parameter or URI extensions. Mime types can be configured in Config.groovy:
grails.mime.types = [ html: ['text/html','application/xhtml+xml'],
xml: ['text/xml', 'application/xml']
// etc.
]
And requests dealt with via the withFormat method:
def list = {
def results = Book.list()
withFormat {
html bookList:result
xml { render results as XML }
}
}
Automatic XML/JSON Unmarshalling
JSON and XML requests can now be automatically unmarshalled via the params object. Given an incoming XML request of:
<book> <title>The Stand</title> <author>Stephen King</author> ... </book>
This can be consumed with:
def save = {
def b = new Book(params['book'])
if(b.save()) {
// deal with book
}
}
Support for Mapping Foreign Key Columns and Join Tables
Grails' ORM DSL now support mappings foreign key columns and join tables for associations. To change the foreign key of a one-to-one you can do:
class Book {
Author author
static mapping = {
columns {
author column:'auth_id'
}
}
}
You can also change the join table and column used for unidirectional one-to-many and many-to-many associations:
class Author {
static hasMany = [books:Book]
static mapping = {
columns {
books joinTable:[name:'authors_books', key:'book_id', column:'author_id']
}
}
}