Simplified groovy template

- less code
- readable thanks to coffee-script syntax
- fixes non-existing contentType check
- nicer code output with better spacing and indentation (especially `contentType`)