Mostly Grails tips from Code Panda

Monthly Archives: June 2008

In this post, I will show how to build a simple yet robust resource modification engine for Maven using GMaven and Groovy Templates.

We sometimes need to generate files in our build cycle that are specific to each server and change per deployment cycle. For some projects, this might be Flash / Flex actionscript files that need to reference the build server. For others, it might be datasource locations that change per build project. While maven provides a built-in resource filtering mechanism, it is tied to parts of the maven lifecycle that might not work well for all projects, and mostly changes resources for War files.

Groovy provides a very robust Templating engine. With the introduction of the GMaven plugin, it becomes possible to filter and re-write resource files using this robust mechanism. Combined with the power of Maven’s built-in profiles mechanism, this solution provides a robust and powerful way to edit Flex / Grails and other resources. Continue reading →

Our recent adventures in Flex/Flash land have required us to have our Flash and Flex components to talk to each other. Here are some ways in which you can get Flash and Flex to pass data from one to the other.

In Flex, we can embed other Flex files or Flash files ( pretty much everything SWF ) with the swfloader component. This component has complete and unload hooks to ActionScript functions that enable us to execute functions. This post will talk about ways in which data can be passed back and forth between the two types of components.

This post cover 3 different ways in which Flex/Flash files can interact with one another. Enjoy!

When I started my new job a few months ago, we inherited a Cairngorm-based Flex REST client that was ugly, clunky and hard to maintain. Worst of all, due to Cairngorm’s brutal MVC model, it didn’t allow us to call the service in the context of the Flex component.

Our architect Tim re-wrote it into a single class, stripping out all the Cairngorm madness so it can be
called within a single service. More recently, I refactored the class into a singleton and removed some legacy Spring Security authentication — now handled by the Jsecurity plugin in Grails.

I’ve been busy figuring out how Grails can help search engine rankings of Flex / Flash applications. In this post, I will show how the SWFObject library can be used with Grails layouts to enable a SEO technique called Progressive Enhancement ( thanks Ted! ).

Progressive Enhancement is a technique that allows the same content to be shown to different users, regardless of the ways in which the content is viewed. The idea is that the same content should appear on a Flash player page and one that is plain HTML and indexed by the Google searchbots. Continue reading →