Monday, April 12, 2010

Don't buy Flash Builder - it's now included in CS5!

Flex Builder has always felt a bit like like Adobe's "ugly duckling" product. I'm used to licensing Flex Builder and Creative Suite separately. Yesterday I tried to buy Flash Builder 4 but failed only 'cos Adobe's UK on-line store was down for maintenance. Wow that was lucky! Today I discover that Flash Builder 4's bundled in CS5 Web Premium now. So I can upgrade my Creative Suite license and I get Flash Builder for free!

Sunday, April 04, 2010

Configuring a default application-wide channel set in Spring BlazeDS

The Spring BlazeDS Integration project provides a very elegant framework for Flex-Java development. However the project documentation (as of 1.0.3) encourages the decoupling of the BlazeDS channel configuration in the client from the channel config in the server. While in many cases this is the right thing to do, in other cases developers may prefer to define the configuration in one place (in services-config.xml) and compile the client(s) against service-config. Developers using the joint Java-Flex project support in Flash Builder, for example, (provided under the hood by Eclipse WTP) will find this approach convenient, especially in the early stages as they are learning the framework.

Unfortunately neither the Spring BlazeDS Integration documentation (as of 1.0.3) nor Adobe's LCDS documentation (as of 3.0) provides an example of how to define an application-wide default channel set in services-config.xml.

You can define a default application-wide channel in service-config.xml as follows:-



With an application-wide default channel set in services-config you can define mx:RemoteObjects, mx:Producers and mc:Consumers in the client as follows without having to specify a channel configuration explicitly. (This assumes the client is compiled against service-config.xml which has been the default in Flex/Flash Builder for projects set up with BlazeDS support since WTP support was introduced in v2.0.1).



and also allows a simpler Spring config as follows:-



Additionally BlazeDS remoting endpoints annotated as Spring BlazeDS endpoints work too without having to specify a channel explicitly as follows:



While it may not always be the right thing to do, configuring an application-wide default channel set in service-config and compiling the client against services-config significantly reduces the complexity of the Spring BlazeDS config in the simple case.