This Week in Grails (2013-15)

Saturday, April 20th, 2013 8:54pm

The Groovy team released Groovy 2.0.8 and 2.1.3 this week.

Peter Ledbrook wrote up some thoughts about the future of Grails on his blog.

Check out this recent GGUG talk on Grails services, command objects and design approaches.


If you want to keep up with these “This Week in Grails” posts you can access them directly via their category link or in an RSS reader with the feed for just these posts.


Translations of this post:



Plugins

There were 3 new plugins released:

  • grooscript-vertx version 0.2.5. Convert your Groovy files to Javascript
  • search-fields version 0.1. Auto-generate search query based on DSL in domain classes
  • yui-war-minify version 1.2. Runs yui-compressor on css and javascript resources at WAR creation time

and 11 updated plugins:

  • build-info version 1.2.4. Provides a controller/view that display basic information about the war file
  • coffeescript-resources version 0.3.8. Create coffeescript modules that automatically compiles on every file change with jCoffeeScript
  • cxf version 1.1.1. Expose Grails services as SOAP web services via CXF
  • cxf-client version 1.5.3. Use existing (or new) Apache CXF wsdl2java generated content to invoke SOAP services
  • easyui version 0.9. Supplies jQuery EasyUI resources and taglibs
  • ember-templates-precompiler version 0.4.1. Precompiles EmberJS powered Handlebars templates
  • envers version 2.1.0. Integrates with Hibernate Envers
  • filterpane version 2.1.3. Adds filtering capabilities
  • gson version 1.1.4. Provides alternate JSON (de)serialization using Google’s Gson library
  • paypal version 0.6.9. Adds PayPal integration
  • uploadr version 0.7.3. HTML5 Drag and Drop file uploader

Interesting Tweets

User groups and Conferences

This Week in Grails (2013-14)

Sunday, April 14th, 2013 11:02am

SpringSource has moved from VMware to EMC as part of Pivotal. Check out Adrian Colyer’s blog post for information about how this will affect Grails, Groovy, and Spring and what the future looks like for us.

The Groovy team did an extensive interview with ZeroTurnaround, lots of interesting stuff there.

Happy Birthday to Grails, the 0.1 release was 7 years ago.

I wrote a blog post about a new plugin that integrates Netty with Grails. It will probably take an integration into Grails core to see real benefits, but there should be some opportunities to improve scalability and performance with this plugin.


If you want to keep up with these “This Week in Grails” posts you can access them directly via their category link or in an RSS reader with the feed for just these posts.


Translations of this post:



Plugins

There were 3 new plugins released:

  • domain-locking version 0.3. Provides an easy way to use optimistic/pessimistic lock
  • nettymvc version 0.1. Adds support for using Netty in Grails
  • typescript version 0.4.1. Helps you manage typescript code in your Grails application

and 16 updated plugins:

  • facebook-sdk version 0.4.10. Allows your application to use the Facebook Platform and develop Facebook apps on Facebook.com or on web sites (with Facebook Connect)
  • file-server version 0.2. Serves files from any directories on disk
  • force-response-download version 0.1.5. Forces the browser to open a dialog for downloading content produced within controller actions
  • geasyui version 0.8. Supplies jQuery EasyUI resources and taglibs
  • geb version 0.9.0. Geb is a library for headless web browsing on the JVM, suitable for automation and functional web testing
  • gorm-interceptors version 0.1.1. Interceptors for GORM methods (excluding find, countBy, addTo, removeFrom methods)
  • gson version 1.1.3. Provides alternate JSON (de)serialization using Google’s Gson library
  • handlebars-resources version 0.3.6. Supports using Handlebars.js templates with the Grails Resources Plugin
  • plastic-criteria version 0.8. Mock Grails Criteria for Unit Tests
  • remote-pagination version 0.4.3. Provides tags for pagination and to sort columns without page refresh using Ajax and loads only the list of objects needed
  • sharding version 1.0. Defines multiple database shards to horizontally scale data
  • slug-generator version 0.3.1. Generates unique slugs for String properties, for example to generate unique ‘nice’ urls for access to domain objects
  • spring-security-twitter version 0.5. Twitter authentication as extension to the Spring Security Core plugin
  • uploadr version 0.7.2. HTML5 Drag and Drop file uploader
  • vaadin version 1.7.3. Adds Vaadin (http://vaadin.com/) integration
  • zkui version 0.5.6. Seamlessly integrates ZK with Grails’ infrastructures; uses the Grails’ infrastructures such as GSP, controllers rather than zk’s zul as in ZKGrails plugin

Interesting Tweets

Jobs



User groups and Conferences

Grails and Netty

Monday, April 01st, 2013 1:15pm

With all of the buzz about the Play vs Grails Smackdown at Devoxx last week, and this framework benchmark comparison from TechEmpower, I thought it would be interesting to look again at Rossen Stoyanchev’s demo project that integrates Spring MVC with Netty. He had mentioned it on the SpringSource internal developer list and I bookmarked it for later since I was curious about Netty.

I spent the weekend converting Rossen’s code to work with Grails, and created a plugin, borrowing some code from the Spring mock Servlet API classes and also from Tomcat. It’s a weird plugin in that it runs concurrently with the regular web app on a different port. I’m currently taking advantage of the work that Grails does, e.g. creating the Spring ApplicationContext, compiling GSPs in production WARs, etc. But it should be easy enough to get it to run standalone. It’s similar to the Dropwizard plugin, which also adds an alternative and higher-performance request path within a Grails application.

Netty is a generic (but high-performance) network library, so it doesn’t have extensive support for the Servlet API. But it does support HTTP, and that’s what Rossen’s code and my version add – a bridging layer between the lower-level Netty approach and the Servlet API. Ideally this provides a performance and scalability boost from Netty’s non-blocking IO, with the familiarity of the request/response/session approach in the Servlet API.

Most everything works in the plugin, but there are some omissions. There’s no support for SSL, and file upload isn’t implemented. You can do all of the usual Grails stuff, i.e. use controllers, services, GORM, etc. There is support for HTTP Sessions, although they’re not serialized to disk at shutdown and there’s no support for distributed sessions. But other than these items, making requests on the Netty port should work pretty much the same as requests on the servlet container port.

You can install the plugin in the usual way, i.e. add this to BuildConfig.groovy

compile ':nettymvc:0.1'

It will start a server socket on port 8080 by default, but you can configure that in Config.groovy, e.g.

grails.plugin.nettymvc.port = 8090

The plugin page is here and the source is here. Please try it out and let me know if there are issues or if you have suggestions for improvements, ideally in the form of pull requests of course :)

This Week in Grails (2013-12)

Saturday, March 30th, 2013 10:49pm

The Groovy team released version 2.1.2 this week.

Check out Graeme’s blog post on the new async features in Grails 2.3.


If you want to keep up with these “This Week in Grails” posts you can access them directly via their category link or in an RSS reader with the feed for just these posts.


Translations of this post:



Plugins

There were 7 new plugins released:

  • google-analytics-tracker version 0.1. Provides a simple way to embed your web application with page view tracking and event tracking of Google Analytics
  • gorm-interceptors version 0.1. Interceptors for GORM methods (excluding find, countBy, addTo, removeFrom methods)
  • mixpanel version 1.0. Integration with www.mixpanel.com analytics
  • sanchez version 1.0. Integration for sanchez.js javascript/html/GSP templates on client and server-side
  • segmentio version 0.1.7. Use Segment.io to send your analytics data to any service you want, without you having to integrate with each one individually
  • tika-parser version 1.3.0. Bundles the Apache Tika toolkit along with a parser service
  • validate-config version 0.4. Adds methods to ConfigObject for validating expected and required properties

and 13 updated plugins:

  • aws-sdk version 1.4.1. Use the Amazon Web Services infrastructure services
  • clover version 3.1.11. Integrates the Clover code coverage tool
  • code-coverage version 1.2.6. Generates code coverage reports using Cobertura
  • facebook-sdk version 0.4.9. Allows your application to use the Facebook Platform and develop Facebook apps on Facebook.com or on web sites (with Facebook Connect)
  • geasyui version 0.7. Supplies jQuery EasyUI resources and taglibs
  • gson version 1.1.2. Provides alternate JSON (de)serialization using Google’s Gson library
  • jaxrs version 0.7. Supports the development of RESTful web services based on the Java API for RESTful Web Services (JSR 311: JAX-RS)
  • jdbc-pool version 7.0.37. Replaces default Grails Commons DBCP Pool with Tomcat JDBC Pool” target=’_blank’>http://people.apache.org/~fhanik/jdbc-pool/)
  • jesque version 0.6.1. Groovier approach to using jesque
  • jquery-validation-ui version 1.4.4. Client Side Validation without writing JavaScript
  • recaptcha version 0.6.3. Integrates ReCaptcha and Mailhide services
  • spring-security-facebook version 0.13.2. Plugin for Facebook Authentication, as extension to Grails Spring Security Core plugin
  • uploadr version 0.7.1. HTML5 Drag and Drop file uploader

Interesting Tweets

Jobs



User groups and Conferences


This Week in Grails (2013-11)

Monday, March 18th, 2013 8:30pm

Graeme has been working on adding more asynchronous support for Grails 2.3, with additional controller features and new support for async GORM. Check out the initial documentation.

You can now register for GR8Conf EU at the “early bird” rates – be sure to get your tickets before the prices go up. They have announced the speaker lineup, and they are looking for sponsors. You can also check out their Laynrd page.

Registration for GR8Conf US is also open, and you have until the end of the week to get your ticket at the “Door Buster” rate.

The SpringOne 2GX call for papers call for papers is open, so submit a talk if you’re interested in speaking there in September. If you want to attend, register here before their prices go up.


If you want to keep up with these “This Week in Grails” posts you can access them directly via their category link or in an RSS reader with the feed for just these posts.


Translations of this post:



Plugins

There was one new plugin released:

and 11 updated plugins:

  • coffeescript-resources version 0.3.7. Create coffeescript modules that automatically compiles on every file change with jCoffeeScript
  • console-enhancements version 1.0. Enhances the grails console output for better visibility
  • cxf-client version 1.5.2. Use existing (or new) Apache CXF wsdl2java generated content to invoke SOAP services
  • geasyui version 0.6. Supplies jQuery EasyUI resources and taglibs
  • goblin version 0.3.3. A browser game framework
  • gson version 1.1. Provides alternate JSON (de)serialization using Google’s Gson library
  • health-control version 0.2. Automated control of services, resources and other things that might fail from time to time
  • plastic-criteria version 0.7. Mock Grails Criteria for Unit Tests
  • spring-security-facebook version 0.13. Plugin for Facebook Authentication, as extension to Grails Spring Security Core plugin
  • spring-security-saml version 1.0.0.M20. SAML 2.x support for the Spring Security Plugin
  • webflow version 2.0.8. Integrates Spring Web Flow with Grails

Interesting Tweets

Jobs



User groups and Conferences


This Week in Grails (2013-10)

Tuesday, March 12th, 2013 10:02am

The speaker lineup for GR8Conf US has been announced, and a partial list of speakers have been announced for GR8Conf EU. Be sure to get your tickets now before the prices go up.

I released a new plugin this week that adds Dropwizard support for Grails. Check out the introductory blog post for usage information and a test project.


If you want to keep up with these “This Week in Grails” posts you can access them directly via their category link or in an RSS reader with the feed for just these posts.


Translations of this post:



Plugins

There were 3 new plugins released:

  • dropwizard version 0.1. Adds support for Dropwizard
  • file-server version 0.1. Serves files from any directories on disk
  • health-control version 0.1. Automated control of services, resources and other things that might fail from time to time

and 14 updated plugins:

  • aws-sdk version 1.3.33. Use the Amazon Web Services infrastructure services
  • bootstrap-crumbs version 1.0.2. Provide simple breadcrumb functionality using the twitter bootstrap library
  • coffeescript-compiler version 0.9.2. Compiles .coffee source files into .js files
  • cxf-client version 1.5.1. Use existing (or new) Apache CXF wsdl2java generated content to invoke SOAP services
  • gson version 1.0.1. Provides alternate JSON (de)serialization using Google’s Gson library
  • hd-image-utils version 0.4. High quality image manipulation plugin for scaling and cropping images. Uses the pure Java java-image-scaling library
  • ic-alendar version 0.3.5. Export event data in the iCalendar format
  • jesque version 0.6.0. Groovier approach to using jesque
  • kickstart-with-bootstrap version 0.9.6. Start your project with a good looking frontend, with adapted scaffolding templates for standard CRUD pages using Twitter Bootstrap
  • mongodb version 1.2.0. Aims to provide an object-mapping layer on top of MongoDB
  • recaptcha version 0.6.2. Integrates ReCaptcha and Mailhide services
  • resources version 1.2. A resource management and processing framework
  • sharding version 0.9. Defines multiple database shards to horizontally scale data
  • wslite version 0.7.2.0. Integrates the https://github.com/jwagenleitner/groovy-wslite library

Interesting Tweets

Jobs



User groups and Conferences


This Week in Grails (2013-09)

Wednesday, March 06th, 2013 2:15pm

We released Grails 2.1.4 and 2.2.1 this week; they are primarily bug fix releases.

Registration for GR8Conf Europe 2013 is now open. Be sure to sign up soon while the prices are very low.

I’ve been seeing a lot of buzz about Dropwizard as a framework for creating REST services. I thought it would be interesting to integrate it with Grails, but it ended up being a lot more work than I expected since the two approaches are very different, and very opinionated. I have an initial implementation available of a plugin and will add some docs and a sample application soon.


If you want to keep up with these “This Week in Grails” posts you can access them directly via their category link or in an RSS reader with the feed for just these posts.


Translations of this post:



Plugins

There was one new plugin released:

and 7 updated plugins:

  • coffeescript-compiler version 0.8.1. Compiles .coffee source files into .js files
  • geasyui version 0.4. Supplies jQuery EasyUI resources and taglibs
  • jquery-validation-ui version 1.4.2. Client Side Validation without writing JavaScript
  • kickstart-with-bootstrap version 0.9.5b. Start your project with a good looking frontend, with adapted scaffolding templates for standard CRUD pages using Twitter Bootstrap
  • localizations version 1.4.4.10. Store i18n strings in a database
  • recaptcha version 0.6.0. Integrates ReCaptcha and Mailhide services
  • redis version 1.3.3. Provides integration with a Redis datastore

Interesting Tweets

User groups and Conferences


Grails Dropwizard Plugin

Wednesday, March 06th, 2013 11:22am

I’ve been seeing a lot of buzz about Dropwizard as a framework for creating REST services. I thought it would be interesting to integrate it with Grails, but it ended up being a lot more work than I expected since the two approaches are very different, and very opinionated. I have released an initial Grails plugin that integrates Dropwizard: dropwizard. The source is here and the docs are here.

To make thing more clear, I created a simple test application. You can download it here.

Available URLs

The application has a simple Person domain class with a dynamically scaffolded controller, so typical URLs like http://localhost:8080/dropwizardtest/person/list work as expected. The Dropwizard resources are mapped under the default “dropwizard” context path, so you can make a GET request (for example in a browser) for http://localhost:8080/dropwizard/people to see the JSON response for all Person instsances; there is one created in BootStrap.groovy and you can easily add more.

You can also view a single instance by id, for example http://localhost:8080/dropwizard/people/1 which should display

{"id":1,"fullName":"Person Jones","jobTitle":"Jefe Grande"}

Since there is only one user, a GET request for http://localhost:8080/dropwizard/people/42 should display

No such user.

You can create a new Person with a POST request to http://localhost:8080/dropwizard/people – do this with a REST client, or the Firefox Poster addon, or even using curl from the commandline:

curl -H "Content-Type: application/json" -H "Accept: application/json" -X POST -d '{"fullName":"Other Person","jobTitle":"Other Title"}' http://localhost:8080/dropwizard/people

Now if you view all instances with http://localhost:8080/dropwizard/people/ it should look like

[{"id":1,"fullName":"Person Jones","jobTitle":"Jefe Grande"},{"id":2,"fullName":"Other Person","jobTitle":"Other Title"}]

or you can use curl again:

curl http://localhost:8080/dropwizard/people/

There is a simple hello-world endpoint which replies with a hello message, and uses a specified name if provided. If you GET http://localhost:8080/dropwizard/hello-world you will see a response similar to

{"id":1,"content":"Hello, Stranger!"}

and if you add a name parameter – http://localhost:8080/dropwizard/hello-world?name=Ralph – you will see

{"id":2,"content":"Hello, Ralph!"}

You can also POST to /hello-world with the data for a Saying instance:

curl -H "Content-Type: application/json" -H "Accept: application/json" -X POST -d '{"id":123,"content":"test saying"}' http://localhost:8080/dropwizard/hello-world

and it will log the information using Logback:

INFO  [2013-03-05 08:35:28,334] grails.app.dropwizard.com.example.helloworld.resources.HelloWorldDropwizardResource: Received a saying: id: 123, content: test saying

The plugin comes with support for Freemarker and Mustache templates. GET http://localhost:8080/dropwizard/views/utf8.ftl to see a Freemarker response, and http://localhost:8080/dropwizard/views/utf8.mustache to see Mustache.

There is also a simple endpoint under http://localhost:8080/dropwizard/info that you can make GET requests for:

Application is running on port : 8080 connectorType : blocking

To test support for tasks, POST to http://localhost:8081/dropwizard/tasks/gc to run a garbage collection using the default “gc” task:

curl -H "Accept: application/json" -X POST http://localhost:8081/dropwizard/tasks/gc

and the response should be

Running GC...
Done!

You can run the sample HelloDropwizardTask too; send a POST request to http://localhost:8081/dropwizard/tasks/hello-task :

curl -H "Accept: application/json" -X POST http://localhost:8081/dropwizard/tasks/hello-task

and it should display

my task complete.

The admin URIs are available on port 8081. GET http://localhost:8081/dropwizard/metrics or http://localhost:8081/dropwizard/metrics?pretty=true to see current metrics:

   {
  "jvm" : {
    "vm" : {
      "name" : "Java HotSpot(TM) 64-Bit Server VM",
      "version" : "1.7.0_11-b21"
    },
    "memory" : {
    ...

GET http://localhost:8081/dropwizard/healthcheck to run all health checks:

* DataSource: OK
* deadlocks: OK
* template: OK

GET http://localhost:8081/dropwizard/threads to view a thread dump:

main id=1 state=WAITING
    - waiting on <0x38a13ac9> (a java.lang.Object)
    - locked <0x38a13ac9> (a java.lang.Object)
    at java.lang.Object.wait(Native Method)
    at java.lang.Object.wait(Object.java:503)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.join(QueuedThreadPool.java:391)
    at org.eclipse.jetty.server.Server.join(Server.java:413)
    at grails.plugin.dropwizard.GrailsService.start(GrailsService.java:131)
    ...

And finally you can GET the simple http://localhost:8081/dropwizard/ping URL to check that everything is functional:

pong

Application notes

Dropwizard typically loads resources from the classpath, so there are a couple of ways to make files available. You can put files in src/java or grails-app/conf and non-source files will be copied to the classpath. This can clutter up those directories though, so you might want to add in a new folder for these files. The sample application has a src/resources folder for this, and adds an event callback in scripts/_Events.groovy to ensure that the files are available:

eventCompileStart = {
   ant.copy(todir: buildSettings.resourcesDir,
            failonerror: false,
            preservelastmodified: true) {
      fileset(dir: 'src/resources') {
         exclude(name: '*.groovy')
         exclude(name: '*.java')
      }
   }
}

You can put banner.txt there if you want a banner displayed and don’t set the Config.groovy property, the YAML config file, Freemarker and Mustache template files, and static resources mapped with AssetsBundles.

As mentioned in the plugin documentation, serialization of domain classes doesn’t work. The plugin explicitly converts Person instances to and from PersonDTO instances (e.g. see PeopleDropwizardResource). GORM isn’t required, so you’re free to use regular POJO/POGO based persistence. There is a somewhat old dto plugin that may or may not help here.

All of the test application’s classes (resources, health checks, etc.) are written in Groovy and are in grails-app/dropwizard, but as described in the docs you can write them in Java and register them yourself rather than using convention-over-configuration and letting them be auto-discovered. Classes in grails-app/dropwizard support dependency injection (for example the dataSource bean in DataSourceHealthCheck), and can conveniently access Config.groovy values with the ConfigValue annotation (see TemplateHealthCheck for an example of this).

This Week in Grails (2013-08)

Wednesday, February 27th, 2013 4:09pm

Rob Fletcher released a new plugin this week for JSON serialization/deserialization using Google’s Gson library.

SpringOne 2GX 2013 has been announced, and it will be September 9-12 in Santa Clara, CA.

Tomas Lin created an interesting looking Grails template project on GitHub that is pre-configured for testing.


If you want to keep up with these “This Week in Grails” posts you can access them directly via their category link or in an RSS reader with the feed for just these posts.


Translations of this post:



Plugins

There were 5 new plugins released:

  • casper-runner version 0.2. Runs functional CapserJS tests
  • goblin version 0.3.2. A browser game framework
  • gson version 1.0. Provides alternate JSON (de)serialization using Google’s Gson library
  • simple-suggestions version 0.1. Suggestion service to provide suggestions to auto complete controls
  • geasyui version 0.3. Supplies jQuery EasyUI resources and taglibs

and 12 updated plugins:

  • aws-sdk version 1.3.32. Use the Amazon Web Services infrastructure services
  • codenarc version 0.18.1. Static code analysis for Groovy
  • dumbster version 0.2. Adds support for the Dumbster SMTP server for testing
  • improx version 0.2. Use interactive mode from other process via TCP
  • jetty version 2.0.3. Makes Jetty the development time container
  • jquery-validation-ui version 1.4.1. Client Side Validation without writing JavaScript
  • kickstart-with-bootstrap version 0.9.2. Start your project with a good looking frontend, with adapted scaffolding templates for standard CRUD pages using Twitter Bootstrap
  • less-resources version 1.3.3.1. Compile .less files into .css files
  • localizations version 1.4.4.9. Store i18n strings in a database
  • plastic-criteria version 0.6. Mock Grails Criteria for Unit Tests
  • release version 2.2.1. Publishes Grails plugins either to a public or private repository
  • vaadin version 1.7.1. Adds Vaadin (http://vaadin.com/) integration

Interesting Tweets

Jobs



User groups and Conferences


This Week in Grails (2013-07)

Saturday, February 23rd, 2013 2:02am

The Groovy team announced three Groovy releases this week.

Check out this interview with Jeff Brown on Grails 2 and Groovy.

Several more Greach videos were released this week. Check out the sessions page and click through to each one to view its video.

Rob Fletcher announced this week that he will no longer be supporting a few of his plugins.

Stéphane Maldini suggested a new grails.org theme.

Programming Grails went to “production” this week, so it should be in print in a month or so.


If you want to keep up with these “This Week in Grails” posts you can access them directly via their category link or in an RSS reader with the feed for just these posts.


Translations of this post:



Plugins

There were 3 new plugins released:

  • dumbster version 0.1. Adds support for the Dumbster SMTP server for testing
  • geasyui version 0.2. Supplies jQuery EasyUI resources and taglibs
  • recaptcha-spring-security version 0.1. Using recaptcha with spring security core for brute force defender

and 11 updated plugins:

  • build-test-data version 2.0.4. Enables the easy creation of test data by automatic inspection of constraints
  • coffeescript-compiler version 0.7. Compiles .coffee source files into .js files
  • cookie-session version 2.0.7. Allows you to store session data in a cookie
  • easygrid version 1.3.0. Provides a convenient and agile way of defining Data Grids
  • ember-templates-precompiler version 0.4.0. Precompiles EmberJS powered Handlebars templates
  • feature-switch version 0.7. Allows turning on and off of features
  • pretty-time version 2.1.3.Final-1.0.1. Displays human readable, relative timestamps
  • remote-pagination version 0.4.2. Provides tags for pagination and to sort columns without page refresh using Ajax and loads only the list of objects needed
  • spreedly version 0.1.7. Provides access to the Spreedly online payment service API
  • spring-security-facebook version 0.12.2. Plugin for Facebook Authentication, as extension to Grails Spring Security Core plugin
  • underscore version 1.4.4. Simple plugin wrapper for useful Underscore.js library

Interesting Tweets

Jobs



User groups and Conferences


Creative Commons License
This work is licensed under a Creative Commons Attribution 3.0 License.