Skip to Main Content
Programming ColdFusion MX, 2nd Edition
book

Programming ColdFusion MX, 2nd Edition

by Rob Brooks-Bilson
August 2003
Intermediate to advanced content levelIntermediate to advanced
1140 pages
68h 45m
English
O'Reilly Media, Inc.
Content preview from Programming ColdFusion MX, 2nd Edition

Flash Remoting with Java Objects Hosted on the ColdFusion MX Server

In Chapter 27, we talked about ColdFusion MX and Java interaction. We covered several ways in which you can leverage Java in your ColdFusion MX applications, including using the ColdFusion MX server to host Java objects. One of the additional benefits of Flash Remoting’s integration with ColdFusion MX is the ability to have Flash MX communicate directly with these Java objects. To take advantage of this feature, you first need to make sure that the directory where your Java object(s) are stored is registered in the Class Path field under the Java and JVM section of the ColdFusion Administrator. After registering, you’ll need to restart the ColdFusion server for the changes to take effect.

Once the class path is set, any public methods in the Java object are available as methods to your Flash MX movie.[5] If you have a Java object called employee.class in com/example/utils, you could reference a public method called getEmployee( ) from within your Flash movie like this:

#include "NetServices.as" // Call the getEmployee() method on the service specified below myService.getEmployee(); function getEmployee_Result(result) { // ActionScript for handling results returned by the Java object } if (inited = = null){ // do this code only once var inited = true; NetServices.setDefaultGatewayUrl("http://localhost/flashservices/gateway"); var gatewayConnection = NetServices.createGatewayConnection( ); // Note getService() includes ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Programming ColdFusion

Programming ColdFusion

Rob Brooks-Bilson

Publisher Resources

ISBN: 0596003803Supplemental ContentErrata Page