Flex And Java Integration

16
Flex and Java Integration Adobe Flex Meet August09 Ravi Sharma

description

Flex And Java Integration

Transcript of Flex And Java Integration

Page 1: Flex And Java Integration

Flex and Java Integration

Adobe Flex Meet August09

Ravi Sharma

Page 2: Flex And Java Integration

Flex and Java

Java technology can be used to create both client- and server-side applications.

While the server-side implementation is widely accepted, the browser-based client-side applications have been less successful because the file sizes are large and the installation is bulky.

Flex is a great solution for Java developers because it

enables them to utilize the power of Java servers while creating expressive and interactive interfaces.

Page 3: Flex And Java Integration

Application Flow

Page 4: Flex And Java Integration

Different techniques for accessing existing web application.

HttpServices

WebServices

RemoteObject

Page 5: Flex And Java Integration

Additional Techniques

Direct socket connections:

Flex client can also open a direct socket connection to network services. This is an important tool mainly for streaming media-type applications.

RTMP(Real Time Messaging Protocol) is primarily used to stream data, audio, and video over the Internet to Flash Player. RTMP maintains a persistent connection with an endpoint and allows real-time communication.

Page 6: Flex And Java Integration

Technology for integration

BlazeDS LCDS

WebORB AMFPhp

Page 7: Flex And Java Integration

BlazeDS Overview

BlazeDS provides a set of services that lets you connect a client-side application to server-side data, and pass data

among multiple clients connected to the server.BlazeDS implements real-time messaging between clients.

A BlazeDS application consists of two parts: a client-side application and a server-side J2EE web application.

Page 8: Flex And Java Integration

The client-side application

A BlazeDS client application is typically an Adobe Flex application.

Flex applications use Flex components to communicate with the BlazeDS server, including the RemoteObject, HTTPService, WebService, Producer, and Consumer components.

All these components are part of the Flex Software Development Kit (SDK).

Page 9: Flex And Java Integration

The BlazeDS server

The BlazeDS server runs in a J2EE application server.

Configure an existing J2EE web application to support BlazeDS:-

1. Add the BlazeDS JAR files and dependent JAR files to the WEB-INF/lib directory.

2. Edit the BlazeDS configuration files in the WEB-INF/flex directory.

3. Define MessageBrokerServlet in WEB-INF/web.xml.

Page 10: Flex And Java Integration

Key Services of BlazeDS

The Remoting Service allows our Flex application to directly invoke methods of Java object deployed in our application server.

The Message Service provides a publish/subscribe infrastructure that allows our Flex application to publish messages and subscribe to a messaging destination. That enabling the development of real-time data push and collaborative application.

Page 11: Flex And Java Integration

Contd…

The Proxy Services allows our Flex application to make cross-domain service requests in a secure manner. It allows our Flex application to access a services available on a different domain.

Without having to deploy a crossdomain policy file on the target domain.

Page 12: Flex And Java Integration

Now

Take a look of

Demo Application

Page 13: Flex And Java Integration

Config file setting

Finally, you must add the class destination in WEB-INF/flex/remoting-config.xml,

<destination id="myJavaClass" >        <properties>                <source>MyRPC</source>                <scope>application</scope>        </properties></destination>

Page 14: Flex And Java Integration

Description of Config The destination id attribute is referenced when you

invoke the class from Flex.

The <source> node points to the fully qualified name of the Java class. i.e. packageName.className

The <scope> node determines when the Java class will be instantiated, Application means the class will be instantiated once

during servlet initialization. Session means the class is instantiated for each user

session. Request resets the class for each invocation.

Page 15: Flex And Java Integration

Client Side Coding

<mx:RemoteObject id="myService"

destination="myJavaClass">

<mx:Button

click="myService.sayHello()" />

<mx:Label text="{myService.sayHello.lastResult}"

/>

Page 16: Flex And Java Integration

QA SessionN

Thanks