Led & Sustained by

G2one Logo

Developed with

Intellij

Powered by

Spring

Flex Plugin

Flex Plugin

This plugin provides integration between Grails and Adobe Flex/BlazeDS.

About Adobe Flex and BlazeDS

Adobe Flex is a cross platform, open source framework for creating rich internet applications (RIA's). Flex applications can access data using RPC services (including RemoteObject, WebService and HTTPService components), the Flex Data Management Service and the Flex Message Service. BlazeDS is Adobe's open source server-based Java remoting and messaging technology.

Features

  • Automatic configuration of Flex related web descriptor elements - For Flex to work configuration of servlets etc. are required in the web descriptor. This plugin automatically does this configuration.
  • Eposing Grails services as Flex remoting destinations - When using Flex remoting services each Java service need to be configured within Flex using xml configuration. When exposing Grails service classes with this plugin this configuration is not needed anymore. The service class will automatically be registered within the Flex message broker.
  • Participation in reloading of exposed Grails services - This plugin participates nicely with the reloading facilities of Grails. When creating new services or exposing existing services, they will be registered in the Flex message broker without restarting the application
  • Embedded BlazeDS libraries
  • Embedded Flex Webtier Compiler - When installing this plugin it will automatically install the Flex Webtier Compiler to your web application (within the WEB-INF folder). In development mode this Webtier Compiler is automatically enabled.

Things not included (yet):

Installation

To install the Flex plugin type this command from your project's root folder:

grails install-plugin flex

Usage

For exposing a Grails service as a remoting destination within the Flex message broker, simply add the following expose property to your service class:

class HelloService {

    static expose = ['flex-remoting']

    def hello() {
        return "Hello World!!!"
    }
}

Next, you can use this service within your Flex application without any other configuration.

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">

    <mx:RemoteObject id="ro" destination="helloService"/>
	
    <mx:Button label="Hello" click="ro.hello()"/>
    <mx:TextInput text="{ro.hello.lastResult}"/>
	
</mx:Application>

Configuration

By default the embedded Flex Webtier Compiler is only enabled in development mode. To explicitly disable it or enable it for other environments, simply add the following property to Config.groovy (or another configured config file):

// enables the webtier compiler for all environments
flex.webtier.compiler.enabled = true

// disables the webtier compiler for all environments
flex.webtier.compiler.enabled = false

// explicit enabling/disabling of the webtier compiler per environment
environments {
    development {
        flex.webtier.compiler.enabled = true
    }
    test {
        flex.webtier.compiler.enabled = true
    }
    production {
        flex.webtier.compiler.enabled = false
    }
}

Specific Flex Webtier Compiler configurations can be done in the flex-webtier-config.xml, which can be found in your project's \web-app\WEB-INF\flex folder after installing the plugin. See Adobe documentation for compiler configurations.

Plugin version history

0.2 (March 6, 2008)

  • Upgraded to BlazeDS release
  • Destination name is now configurable (GRAILSPLUGINS-226)
</