Archive for October, 2011

In my last project assignment I found Spring BlazeDS Integration API is very fruitful. It really helps developer to focus on only business implementation of application and forget about backend server level configuration. Spring BlazeDS Integration is a top-level Spring project, and a component of the complete Spring Web stack. This project’s purpose is to make it easier to build Spring-powered Rich Internet Applications using Adobe Flex as the front-end client. It aims to achieve this purpose by providing first-class support for using the open source Adobe BlazeDS project and its powerful remoting and messaging facilities in combination with the familiar Spring programming model.

Spring FrameworkBlazeDS

By this article I am going to share the basic and essential part of this API that helps to understand the integration process. In this example I am going to use Spring+BlazeDS integration API for integrating backend Spring based J2EE layer into client layer Flex application.

What I am going to cover here:
Creating Spring based J2EE backend layer
# Implementing Spring BlazeDS Integration API
# Creating Flex application for client layer

List of software used for this implementation:
FlashBuilder 4.5
# Flex Framework SDK 4
# Apache Tomcat 7.0
# Spring BlazeDS Integration 1.5.0
# Spring framework library
# BlazeDS library
# Eclipse with WTP for creating dynamic web application
Note – we can use compatible preceding version of these software also.

Creating Spring based J2EE backend layer

In this step first create a dynamic web application using Eclipse IDE by File->New->Project->Web- Dynamic Web Project options and enter the basic project details and settings.

New Dynamic ProjectContext Root

In the above steps cross check the context root name for this application. This context root name will be use for client layer integration. After this steps this project will look like below in project explorer of Eclipse IDE.

Project Explorer

Now put all the jar files of downloaded library in WebContent->WEB-INF->lib folder. Total number of jar files in lib folder are 36.

List of library files

Tips : If you unable to find any of these listed jar files then you can manually download this from by entering the full name of zar file. Make sure you have all the respective library jar files of Spring Framework, BlazeDS and Spring+BlazeDS integration API.

Now after this initial project setup steps move to J2EE layer development. In this example I am fetching the list of country for Flex client layer.

Creating Spring based J2EE backend layer

First modify ‘web.xml’ in the ‘WEB-INF’ directory. Go to the WebContent->WEB-INF->web.xml directory. Here I define a DispatcherServlet (also known as a ‘Front Controller’. It is going to control all the requests. This servlet definition also has an attendant <servlet-mapping/> entry that maps to the URL patterns that will be used for making request. Here I am defining url pattern as /messageBroker/*, that means all request url containing this pattern will be routed to the ‘blazeds’ servlet (the DispatcherServlet).

Modifying the Deployment Descriptor web.xml file

Now I have created blazeds-servlet.xml file in WebContent->WEB-INF-> directory. This file contains the bean definitions used by the DispatcherServlet. It is the WebApplicationContext where all web-related components go. The name of this file is determined by the value of the <servlet-name/> element from the 'web.xml', with '-servlet' appended to it (hence 'blazeds-servlet.xml'). In this I am configuring spring annotation framework and providing a base package location of J2EE interface layer classes for Flex communication. And most important thing is configuring message-broker of Spring+BlazeDS integration API for object serialization.

Configuring WebApplicationContext

After this we have to define blazeDS communication channel in services-config.xml file at WebContent->WEB-INF->flex-> (this is a default location of services config file).

Configuring services config file

Now all the configuration lavel part is done and move to Class lavel coding. Just have a look on this class.

J2EE layer service class MapManager

The best part of Spring+BlazeDS Integration API is we now we don’t need to configure remote-config file for every java class. We just have to write a one single Spring annotation tag in class and need to provide a remoting communication channel information. In the above class I have used these three basic Spring annotation tag:

  • @Service(“mapManagerService”) – for giving a destination name of this class for Flex layer remoting.
  • @RemotingDestination(channels={“my-amf”}) – for providing a remoting communication channel name.
  • @RemotingInclude – using this tag we can include the method of the class for remoting.

Now we are ready to deploy this application on server.

Creating Flex application for client layer

In Flex layer we don’t have to do anything extra just need to create a Remote Object and call the exposed service destination from J2EE layer. For testing we don’t need to deploy this Flex application on server.

Client layer Flex Application

Output screen of Flex application

Output screen of client layer Flex application

Reference link:

Source files of example projet :


Think Different - Steve Jobs

We lost a great innovator, great entrepreneur and creative person Steven P. Jobs. Steve Jobs an innovative mind behind the success of iMac, iPod, iTunes, iPhone, iPad and many more products.

Apple has lost a visionary and creative genius, and the world has lost an amazing human being. – Mr. Cook (CEO Apple).

In more than three decade career, Jobs transformed technology industry’s into the innovation center. The popular “i” series product of Apple are a reflections of Steve’s innovation and the tech world lost his innovative machine.

Mr. Steve Jobs you will be missed for every innvoative and creative idea.