You will need the following software installed:
- Eclipse 3.3 Classic
- Flex Builder 3 Beta 3 (Eclipse Plug-Ins)
- Any Java Application Server (Tomcat, JBoss, WebLogic, WebSphere, etc.)
- BlazeDS
To create a simple Remoting Application:
- Unjar the blazeds.war file from BlazeDS into your application server's deployment folder. For instance, on JBoss use
/server/default/deploy/blazeds.war - Start Eclipse / Flex Builder
- Create a new Java Project that you can use to configure BlazeDS and add Java classes to your web application.
- Use a project name like "blazeds_server"
- Create the project from existing source; use the path of the WEB-INF directory of your deployed BlazeDS WAR, such as:
/server/default/deploy/blazeds.war/WEB-INF/ - Add the src directory to the build path
- Use the WEB-INF/classes directory as the output folder
- Create a new Java class called HelloWorld.java with the following code:
- Configure BlazeDS to allow remoting requests to the HelloWorld class by adding a destination to the remoting-config.xml file found in the WEB-INF/flex directory. Use the following destination configuration:
- Start your application server and verify your web application is configured by going to the following URL (The port may vary depending on your application server configuration): http://localhost:8080/blazeds/
(If your server is not configured to display directory contents, you might see a 404 error. This is OK.) - Create a new Flex Project
- For the project name, type "testHelloWorld" Select "J2EE" as the Application Server Type
- Select "Use remote object access service" and LiveCycle Data Services
- Specify the Root folder to be to location of your deployed WAR file
- Specify the Root URL to be: http://localhost:8080/blazeds (Your port name may be different depending on your application server configuration)
- Specify the Context Root to be: /blazeds
- Verify the configuration and click Finish
- Create the Flex application by updating the testHelloWorld.mxml file with the following source code:
- Run the application and test it by typing your name into the TextInput box. You should see "hello,
" displayed beneath the TextInput like the image below.
public class HelloWorld {
public String sayHello(String name) {
return "hello, " + name;
}
}
More info at:
InfoQ: Building Web and Desktop Applications with BlazeDS and AMF
No comments:
Post a Comment