It’s a two-for-one today – a “gotcha” and a “how to” all rolled into one, this time about redirecting in a Grails filter.
Much like my favicon woes my initial attempt to redirect to a primary domain (a .com without the “www” prefix) had some unexpected consequences when deployed to a live server on CloudFoundry – I started getting warnings that my site had gone down!
In this post I’ll hopefully save you the panic of CloudFoundry telling you that your site’s not responding when you try to rationalise your domain names!
The usually simple upgrade process in Grails has caused me a few headaches in moving from 1.2.2 to 1.3.1. I skipped the 1.3 upgrade because there were a few people having issues on the mailing list but yesterday I bit the bullet and encountered a couple of problems.
I think the release notes for Grails 1.3.x have been unusually poor so this post has the issues I’ve encountered in the hope that you won’t go quite as mad as I have. I’ll keep it updated if I find more problems. Continue reading
I just came across this problem using the datePicker tag in a gsp – it appeared that there was no way to stop the tag showing today’s date when no value was set on the bean. Continue reading
Aspect Oriented Programming is a concept which will be familiar to users of the Spring Framework as one of its core features. However, the details of how to get AOP working in Grails appear thin on the ground, so in this post I will show how to set up a simple aspect then configure and apply it using attributes. I will assume some familiarity with Spring AOP so I won’t explain the terminology or general concepts since they are exactly the same in Java as they are in Grails. Continue reading
The first sign something was wrong was the JVM bombing out with a “java.lang.OutOfMemoryError: PermGen space” error. All I’d done was change a gsp, so I restarted and after a long wait the same thing happened and it was then I noticed that the compiler just kept recompiling 4 classes in a loop until the JVM bombed.
This had happened to me once before when I’d managed to set the time incorrectly on my PC so some of my files appeared to be modified in the future. However this time I’d not done anything of the sort.
The Grails Spring Security plugin is a wonderful thing and certainly worthy of more time spent on it than in this quick post. It saves days, if not weeks of work, plumbing in the standard security model of most websites. Notwithstanding its obvious benefits, I have noticed that many people struggle with some features of it, especially when retro-fitting it to an existing database schema and I can only assume it’s because the best examples of performing common tasks are only seen when generating the classes from scratch, using the generate-registration and generate-manager scripts.
So far I’ve shown how to produce JSON from simple collections and how to convert domain objects to JSON, in this final post in my three-part look at rendering JSON from Grails controllers, we’ll take a look at customising the way objects are rendered by the JSON converter. Continue reading