AIR and Groovy via Spring
As a fun way to while away a Saturday evening, I decided to look at Joe's Behavioral Analytics backend code to see if I could create a Flex-based AIR application that talked to services written in Groovy. There's not really much documentation out there to help so it was a very hit and miss experience but eventually I had a simple AIR application making a RemoteObject call to a Groovy class and getting data back. I'm going to have to talk to Joe about cleaning up the installation I've ended up with but here are the highlights (and I'll blog more about this once I have all the pieces cleaned up):
- JBoss 4.2.3 GA installed as a Server in Eclipse (using the Web Tool Platform JEE stuff)
- Spring framework 2.5.5
- A Spring-based Flex factory that allows Flex Remoting to talk to objects via Spring (author Jeff Vroom)
- Groovy - set up per Joe's recent instructions
- BlazeDS providing the Flex Remoting service
<factories>
<factory id="spring" class="flex.samples.factories.SpringFactory"/>
</factories>
<!-- Spring -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext.xml</param-value>
</context-param>
<!-- load Spring's WebApplicationContext -->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<destination id="place">
<properties>
<factory>spring</factory>
<source>placeholder</source>
</properties>
</destination>
Create a Flex AIR project and define a RemoteObject that refers to the destination you just defined:
<mx:RemoteObject id="bcp"
destination="place"
endpoint="http://127.0.0.1:8080/bcpbackend/messagebroker/amf"
>
<mx:method name="test" result="testResult(event)" fault="testFault(event)"/>
</mx:RemoteObject>
Add the placeholder bean definition to your applicationContext.xml file:
<bean id="placeholder" class="com.broadchoice.bcp.Placeholder"/>


There are no comments for this entry.
[Add Comment]