1. POJO Sample Project Installation
What It Does
The POJO sample application shows a session scope counter. If you click on the Go button, or if you reload the Flex application via the Reload button of your browser, the counter will increment as its current value is stored in the user HTTP session.
More specifically, it illustrates the configuration of a POJO service via the Flex-services.xml file:
... <destination id="pojo"> <channels> <channel ref="my-graniteamf"/> </channels> <properties> <scope>session</scope> <source>test.pojo.PojoService</source> </properties> </destination> ...
The POJO destination manages a simple Java class service, test.pojo.PojoService, whose scope is session. In this way, the instance is kept between HTTP requests.
Requirements
Follow general requirements here, then:
- Download Tomcat.
- Download graniteds-pojo-1.2.0.zip.
Installation & Deployment
Follow these steps:
- Unzip the Tomcat binary distribution somewhere on your computer; for example /apache-tomcat-6.0.16.
- Start Eclipse, right-click in the Package Explorer view, choose Import, then General / Existing Projects into Workspace, choose Select Archive File, browse to graniteds-pojo-1.2.0.zip, and click on Finish.
- Edit the env.properties file in the root directory of the graniteds_pojo project and adjust the following variables:
# Set 'FLEX_HOME' property to your flex2 sdk installation directory and # 'FLEX_TASKS_JAR' to your flexTasks.jar location. # WARNING: This property must have this exact name ('FLEX_HOME'). FLEX_HOME=/flex_sdk_2 FLEX_TASKS_JAR=${FLEX_HOME}/lib/flexTasks.jar # Set 'TOMCAT_HOME' property to your Tomcat installation directory and # 'TOMCAT_HOME_DEPLOY' to your deploy directory. TOMCAT_HOME=/apache-tomcat-6.0.16 TOMCAT_HOME_DEPLOY=${TOMCAT_HOME}/webappsThe TOMCAT_HOME_DEPLOY variable should be ok without modification.
- Open an Eclipse Ant view (Window / Show View / Ant), drag and drop the build.xml file, found in the root directory of the graniteds_pojo project, on it, and double-click the Deploy target. This should compile, package, and deploy the POJO sample application in Tomcat.
- Start Tomcat (startup.bat or startup.sh in /apache-tomcat-6.0.16/bin).
- Point your browser to http://localhost:8080/graniteds-pojo/.
You should now see the POJO sample application running.
