Installing Flash Remoting for Java (aka openamf)
This tutorial assume you have Tomcat and the needed jdk installed, if not follow Tomcat installation instructions
Next install the Flash remoting components. The components include the classes you need to connect to Flash remoting, and also debugging and formatting classes that will help out when developing.
Next download the current version of OPENAMF from http://sourceforge.net/projects/openamf/
After you have downloaded the current version of OPENAMF unzip them and take a look at the files. You will see many folders, but three main files that can be used immediately: openamf.war for Tomcat deployment , openamf.jar to add the library to your own application and openamf.ear used for J2EE deployment, but not supported by Tomcat . Other folders contains source code, examples and javadocs to inspect classes. Since the README quick start ask to drop the war file in the webapps folder and start your server, sometimes gives some error and probably will not start in Tomcat. So having download all the pieces, let's go over the HelloWorld example in Tomcat.

Tomcat Hello World
Tomcat will look for applications in webapps directory (or those specified in catalina folder) and will start any servlet needed for them. This means that some of them could fails for any reason and the application won't start, so it's important to look at the startup screen or check the logs for possible errors in the startup process. If you get no errors, then your application start ok and that's our goal for our Hello World example. In sake of simplicity, let's use webapps folder for our stuff.
Locate your Tomcat directory and the webapps folder inside it and create
- a folder named helloworld
- a folder helloworld/WEB-INF
- folders helloworld/WEB-INF/classes and helloworld/WEB-INF/lib
Ok, this is our base folder structure that any web application should adhere based on Sun guidelines. Inside classes folder will be the source and compiled code for our classes, and inside lib any external library that we need (usually as jar file) including of course the openamf.jar. Since we need all of them, unzip the openamf file if you didn't do yet, and copy this files from the unzipped openamf distribution:
- copy openamf.jar in the main folder to Tomcat helloworld/WEB-INF/lib
- copy all files inside lib folder to Tomcat helloworld/WEB-INF/lib
- copy files /src/web/WEB-INF/build-webservice.xml and /src/web/WEB-INF/openamf-config.xml to Tomcat helloworld/WEB-INF/
In our simple example we don't need all of the jar files, but documentation is not clear about which one we can skip, so we just copy all the content
Ok, we have the needed external classes and the folder structure, but Tomcat needs also additional information to map servlet resources (the gateway) in our application, so let's create a file named web.xml with the following content:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
"http://java.sun.com/j2ee/dtds/web-app_2.2.dtd">
<web-app>
<servlet>
<servlet-name>DefaultGateway</servlet-name>
<display-name>DefaultGateway</display-name>
<description>DefaultGateway</description>
<servlet-class>org.openamf.DefaultGateway</servlet-class>
<init-param>
<param-name>OPENAMF_CONFIG</param-name>
<param-value>/WEB-INF/openamf-config.xml</param-value>
<description>Location of the OpenAMF config file.</description>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>DefaultGateway</servlet-name>
<url-pattern>/gateway</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>30</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
</web-app>
Save this file to Tomcat helloworld/WEB-INF/ and we are almost done with the structure ... but wait, we need also to write the helloWorld class and Flash client, so le's go to the next task

5 most recent
Flash button as Flex icon
Tree menu
Flash Spell Checker
Flash Remoting Library
MX 2004 Chart/Poll
Articles