Grails

Important Links for Grails

It's so crazy that this is not easily found or published on the grails site.  There is an argument for using the maven site generator since this type of stuff can be found in a standard location in the site navigation.  Grails should take a lesson here, convention over configuration;)  (this is tongue in cheek)

you gotta do encodeAsURL for anything in the URL

In testing spotmouth, came across some spots that had ampersands in the names.  I put the names in the URL (heard it's good for seo), but when I did a request for the spot with the ampersand in it, I got a 404.

I needed to call the "encodeAsUrl()" on the values that could contain these types of characters.  here's an example of what I am doing:

 

grails chain does a redirect

Wow, should've known this, like 2 years ago...
Anyway, I call chain in many of my controllers as a way to pass a model from one controller action, to the other.  I did not know that grails is actually storing the model in flash and doing a http redirect to the next action.
I should probably be using the "forward" for what I need to do.

Enabling AJP with grails local dev environment

I am implementing a site (spotmouth) that is using grails and Drupal.  Locally for my drupal stuff, I am running the excellent XAMPP.
I wanted my local grails app behind apache so it would be a lot closer to what my production configuration would be like.  It turns out that by adding the following file to my Grails app, it will enable the AJP port for tomcat.
 
Copy the _Events.groovy  file (below) to your scripts folder in your grails app.   Of course, don't forget your httpd.conf files to proxy your app.

watch out for those big transactions and solr

I have a quartz job that will periodically call a grails service to tell it import data located within csv files.  For reasons unknown, the jobs were failing with the following stacktrace (which really didn't tell me anything)

 

GROOVY Console java.lang.NoClassDefFoundError: org/apache/xerces/parsers/AbstractSAXParser

I installed the Groovy Console.  It's a pretty nifty and easy way to quickly run some java that you need to quickly iterate through the write/test/fix cycle.

I was trying to parse some html into xml, and I got the following error:

java.lang.NoClassDefFoundError: org/apache/xerces/parsers/AbstractSAXParser

I tried adding 3 different versions of xercesImpl to my Groovy Console classpath, to no avail.  While adding to the groovy classpath worked for some jars (i.e. commons-io), it did not work for the xercesImpl jar.

spring batch

Here are a few tips if you want to incorporate the spring batch project...

1)  Make sure you get the xsd and namespace stuff right in your resources.xml file   I had to combine a few namespaces from the example files and ended up with an extra double quote that affected the bean creation.

Here's where I ended it:

spring batch in grails

I am trying to setup the spring batch project (2.0M4 version) to run with grails (1.2)  I wanted to get the sample stuff up and running, so I created groovy files out of the various sample files that came with spring batch.  Unfortunately, the sample files use Java inner classes, which groovy can't handle yet.

For now, I will just make these Java files, but I was a little surprised since I thought just about any syntactically correct java file was a valid Groovy file.  Guess again.  You learn something every day.

 

Testing drupal with grails webtest

I was implementing a Drupal site with a custom module that uses a custom mysql database.  The client reported problems with a custom module.  I tried reproducting the problem, but after trying 20 some combinations out of 1000+ test elements, I wasn't able to reproduce the questionable behavior.

Enter grails with webtest.

Debugging grails/iUI

I am building out a iphone application using grails and the iUI plugin

Syndicate content