This article explains how to setup BlazeDS for your J2EE web application.
BlazeDS adds a lot of power to your web applications. You can expose your Java classes as Remoting services. You can use the Messaging service of BlazeDS to expose publish subscribe messaging destinations and also use the Proxy service to invoke other services.
More details about BlazeDS can be found at this URL http://opensource.adobe.com/wiki/display/blazeds/BlazeDS
Updated: Free AIR based Tool to generate Flex code for consuming/exposing Java classes as BlazeDS Remoting services. Visit this URL for more details https://sujitreddyg.wordpress.com/2009/05/07/blazemonster/
Just follow the steps below you will have BlazeDS setup in no time 🙂
Download release build of BlazeDS. BlazeDS release builds are available at this URL http://opensource.adobe.com/wiki/display/blazeds/Release+Builds Click on “Download the BlazeDS binary distribution” to download the binary distribution. Binary distribution has just jar files and other configuration files required.
Go to folder where you saved the downloaded file in Step 1. You would have downloaded a file named blazeds-bin-220.127.116.1131.zip. Extract the content in this file to a folder named blazeds-bin-18.104.22.16831
In the blazeds-bin-22.214.171.12431 folder you will find a file named blazeds.war and blazeds-bin-readme.htm. blazeds-bin-readme.htm contains terms and conditions and license details. blazeds.war contains required jar files and configuration files for setting up BlazeDS.
Extract the content in blazeds.war file into a folder called blazeds. You can extract the content using tools like winzip.
Now we have downloaded and have the required files extracted to setup BlazeDS for a web application. Let’s create a web application.
Creating web application
If you don’t have Tomcat installed, install Tomcat from http://tomcat.apache.org/
In your Tomcat installation directory, you will find a folder named webapps. Usually it is at this location on Windows Operating System “C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps”
Create a web application named samplewebapp. You do this by just creating folder named samplewebapp under webapps folder.
Setting up BlazeDS
We will setup BlazeDS for the web application created in the previous step.
blazeds – this is the folder in which we have blazeds.war content extracted into in Step 3
samplewebapp – this is the folder created in Step 4
Copy all .jar files from blazeds/WEB-INF/lib to samplewebapp/WEB-INF/lib
Copy blazeds/WEB-INF/flex folder to samplewebapp/WEB-INF
This folder (blazeds/WEB-INF/flex) contains BlazeDS configuration files. Use these files to configure Remoting/Messaging/Proxy services.
Now we will add Servlet mapping for BlazeDS Servlet named MessageBrokerServlet, so that BlazeDS is invoked when you send request for a Remoting/Messaging/Proxy destination using any of the channels supported.
Copy blazeds/WEB-INF/web.xml to samplewebapp/WEB-INF
If you already have a web.xml configured, then you can just copy the Servlet mapping for MessageBrokerServlet and the session listener. You can either copy the content below or copy it from the blazeds/WEB-INF/web.xml
<!-- Http Flex Session attribute and binding listener support -->
<!-- MessageBroker Servlet -->
That’s it you have BlazeDS setup for your web application. 🙂
Now that you have BlazeDS set up you can try invoking Java methods from your Flex applications or create a simple chat application. You can find articles at the URLs below.
Adobe Rocks!!! 🙂