Integrating a simple Flex search application with Grails (Bill Bejeck)
Bill Bejeck, Flex, Grails August 13th, 2008
This articles comes from Adobe’s Developer connection. Bill Bejeck, a software engineer for Near Infinity in northern Virginia, demonstrates how a Flex client can communicate with a Grails applications. He lays out pretty well everything you need to follow the steps (tools and code).
The Grails framework greatly simplifies the task of building a Java web application. This article illustrates one approach to integrating a Flex application with a Java server application using Grails. The sample application for this article is a simple Flex search application, but the principles shown here still apply for building more complex applications.
While there are many great options available for connecting Flex applications with a server application, for example, LiveCycle Data Services ES or its open source counterpart BlazeDS, the sample application uses a RESTful approach for client-server communication. It is true that using the aforementioned frameworks offer several powerful advantages, but there are benefits to using a XML/RESTful approach that should not automatically be discounted. Chief among these are:
- RESTful services are straightforward to implement and maintain.
- The server and client applications, respectively, either respond with XML or parse responses sent in XML, freeing them from dependence on any particular platform. Note: Using XML is not required; the approach outlined here could be used with JSON.
- No mapping files of any kind are required.
- There is less of a learning curve if this is the first experience building a Flex client with a Java server application.
The article starts heavily on the Flex side, but don’t be discouraged, it is only a matter of a small refactoring on a previous application he built, just to be sure the RESTful connections are in the proper state. The Grails side is pretty straight forward, as you would expect, the SearchController outputs everything in XML, a rather simple job given the powerful abstractions founs in Grails’s controllers.
Tags: Bill Bejeck, Flex, Grails
About