Showing posts from August, 2015

How to upgrade Grails 2 applications and plugins to Grails 3

How to upgrade Grails 2 applications and plugins to work with Grails 3  The  Grails  framework is a web framework  for developing dynamic websites. It has been recently upgraded to version 3.0 and the upgrade has introduced breaking changes. According to the grails documentation, Grails 3.0 is a complete ground up rewrite of Grails and introduces new concepts and components for many parts of the framework. The 'rewrite' part means that a lot has changed, including class packages. This means that your plugin will break if it imports any of the Grails API packages that have been moved. Although the Grails documentation provides a guide for upgrading applications and plugins, it does not provide information about all the Grails API package changes. To save software development time, please find some of the package changes below. Grails 2 Grails 3 org.codehaus.groovy.grails.web.servlet.mvc.GrailsParameterMap grails.web.servlet.mvc.GrailsParameterMap org.cod

Parsing and binding date formats from params in Grails.

" Grails is a powerful web framework for the Java platform aimed at multiplying developers' productivity" - grails. We recently decided to rewrite some parts of our software  ( written in grails )as web applications.  The reason we made that decision is something I hope to write about soon. The task required us to send JSON strings (POST request) that contain datetime information along with other bits for data to the server.  To bind a date string from the 'param' seamlessly ( without writing extra code to extract the date in your controller) you need to add the following to your grails config file ( config.groovy or application.yml ). grails.databinding.dateFormats = [ "yyyy-MM-dd'T'HH:mm:ss.SSSXXX", "yyyy-MM-dd'T'HH:mm:ss.SSSZ" ,'yyyy-MM-dd HH:mm:ss.S','MMddyyyy' ] With the above configuration in place, there was no need to extract the date and bind it manually to the domain class or comma