Flash Remoting for J2EE
- Macromedia Flash is a multimedia graphics program specially for use on the Web
- Flash enables you to create interactive “movies” on the Web
- Flash uses vector graphics, which means that the graphics can be scaled to any size without losing clarity/quality
- Flash does not require programming skills and is easy to learn
The advantages of Flash are:
- Flash loads much faster than animated images
- Flash allows interactivity, animated images do not
- Flash does not require programming skills, java applets do
Flash technology has become extremely popular recently. Now nearly every site in the Net, if it is not built completely with Flash, has got Flash elements in it. Have you ever heard of Flash games or Flash movies? I bet you had. Have you ever thought of enlivening your site with some Flash? Or do you dream of creating your own Flash game? You already use Flash but want to know more? Well, now you can learn Flash from the very basics up to creating Flash masterpieces
Flash Remoting for J2EE
Flash Remoting MX enables Flash MX clients running in a browser or on a user’s desktop to access and invoke methods on server-side components running in a J2EE, Cold Fusion, or .NET application server. It is an essential piece of Macromedia’s toolset for creating Rich Internet Applications. These applications are deployed over the Web and provide a desktop-software-like interface to server-side application features.
This is targeted toward J2EE developers. It requires some familiarity with Macromedia Flash and its ActionScript scripting language. Flash developers building interfaces to J2EE applications will also benefit from the information provided here
How Flash Remoting for J2EE Works
For those unfamiliar with Flash Remoting MX, the quickest way to get started is to download evaluation versions of Flash Remoting MX, Flash MX, and the Flash MX Remoting Components from Macromedia. If you download JRun 4, Flash Remoting is included. Macromedia has done a good job of providing simple examples and introductory documentation with Flash Remoting.
Flash Remoting for J2EE depends on features in the Flash MX player, a couple of ActionScript libraries for the Flash MX player, and a Java servlet that runs in the application server. Installing the Flash Remoting Components provides the ActionScript libraries and installing Flash Remoting for J2EE provides the servlet and supporting classes that run in your application server.
The Flash MX player handles serializing and deserializing ActionScript objects to and from a proprietary binary data format called Action Message Format (AMF). AMF serialized objects are the payload of HTTP requests and responses sent between the Flash MX client and the application server.
The client-side ActionScript libraries provide the ActionScript objects that a Flash developer uses to connect to and invoke methods on components in the application server. They also provide objects that are helpful for debugging the connection.
In a J2EE application server, Flash Remoting consists of a single servlet,
flashgateway.controller.GatewayServlet, and supporting classes. The servlet and supporting classes are commonly referred to as the “gateway.” The gateway uses introspection to locate and invoke methods on Java objects.
A typical lifecycle of a Flash Remoting call is:
- The Flash client connects to the gateway.
- The Flash client names a server-side component on which it wants to invoke a method.
- The Flash client invokes a method on the server-side component, optionally providing arguments.
- The Flash player issues an HTTP request that identifies the component and method to invoke and contains the arguments serialized in AMF format.
- The gateway receives the request and deserializes the AMF objects into Java objects.
- The gateway uses introspection to locate and create the named object and invokes the identified method passing the deserialized arguments.
- The gateway serializes the method return value (or thrown exception) into the AMF format.
- The gateway constructs and sends an HTTP response to Flash, including the serialized result.
- Flash receives the response and deserializes the return value to an ActionScript object.
- Flash invokes a callback defined by the Flash developer to indicate that the method invocation has returned.
Macromedia provides a UML sequence diagram of this lifecycle.
Flash clients may invoke methods on regular Java objects, EJBs, and servlets. In the Cold Fusion and .NET implementations, a Flash client may also invoke methods on web services proxied by Flash Remoting. In J2EE implementations, a little work is required to enable web services communication.
How To Best Use Flash Remoting and Why
With the above description of Flash Remoting, we are ready to get into the details.
Install Flash Remoting in a Web Application
Because the Remoting gateway has to locate and invoke methods on classes in your application, a class loader that has access to your classes must load it. While Macromedia is somewhat vague on the issue, I strongly recommend installing Flash Remoting for your application by:
flashgateway.warfiles installed by the Macromedia installer.
- Placing it in your web application’s
- Mapping the gateway for your web application by adding the following to your web application’s
<code> <servlet> <servlet-name>FlashGatewayServlet</servlet-name> <display-name>Flash Remoting Servlet</display-name> <description>Servlet-based plugin to Flash Remoting</description> <servlet-class>flashgateway.controller.GatewayServlet</servlet-class> <load-on-startup>10</load-on-startup> </servlet> <servlet-mapping> <servlet-name>FlashGatewayServlet</servlet-name> <url-pattern>/gateway</url-pattern> </servlet-mapping></code>
This will make the Remoting Gateway Service available at http://www.yourdomain.com/yourwebapp/gateway. All classes in your application will be visible to Flash Remoting. Because Flash Remoting is installed as a servlet, it can be installed in any J2EE application server that supports servlets 1.2+, including but not limited to Caucho Resin, Jakarta Tomcat, BEA WebLogic, IBM WebSphere, Sun One AS, ATG Dynamo, and Oracle 9iAS.
- Flash Remoting for J2EE
- J2EE Checklists
- AWT vs Swings
- What is Beehive
- CGI Tutorials
- CORBA tutorials
- J2EE Application server
- J2EE History
- J2EE Design Patterns
- J2EE Interview Questions
- Application Server
- What is Manifest
- What is Maven
- Maven 2
- POJO Application Frameworks
- Web 2.0
- AWT vs Swings
- J2ME- Java2,Micro Edition
- iBatis DAO
- Working with eclipse and CVS
- XDoclet tutorial
- Cross-site scripting
- Cross-site scripting – part 2
- Workflow Component
- How to check performance in J2EE applications
- Sun VirtualBox
- Secure Coding Guidelines
- Eclipse Shortcuts
- Applications on Eclipse
- Extension Points
- Best place in the internet where you will get Java J2ee pdf tutorials
- DISTRIBUTED MULTI-TIERED APPLICATION
- J2EE Containers
- Adaptive vs Responsive design
- Creating an Eclipse RCP application
- ElasticSearch – Storage Architecture using Inverted Indexes
- Architectural Considerations for using Elasticsearch
- How to use Elasticsearch with SQL Server