Flex And Java Integration


Published on

Flex And Java Integration

Published in: Technology
  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Flex And Java Integration

  1. 1. Flex and Java Integration Adobe Flex Meet August09 Ravi Sharma
  2. 2. Flex and Java <ul><li>Java technology can be used to create both client- and server-side applications. </li></ul><ul><li>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. </li></ul><ul><li>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. </li></ul>
  3. 3. Application Flow
  4. 4. Different techniques for accessing existing web application. <ul><li>HttpServices </li></ul><ul><li>WebServices </li></ul><ul><li>RemoteObject </li></ul>
  5. 5. Additional Techniques <ul><li>Direct socket connections: </li></ul><ul><li>Flex client can also open a direct socket connection to network services. This is an important tool mainly for streaming media-type applications. </li></ul><ul><li>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. </li></ul>
  6. 6. Technology for integration BlazeDS LCDS WebORB AMFPhp
  7. 7. BlazeDS Overview <ul><li>BlazeDS provides a set of services that lets you connect a client-side application to server-side data, and pass data </li></ul><ul><li>among multiple clients connected to the server.BlazeDS implements real-time messaging between clients. </li></ul><ul><li>A BlazeDS application consists of two parts: a client-side application and a server-side J2EE web application. </li></ul>
  8. 8. The client-side application <ul><li>A BlazeDS client application is typically an Adobe Flex application. </li></ul><ul><li>Flex applications use Flex components to communicate with the BlazeDS server, including the RemoteObject, HTTPService, WebService, Producer, and Consumer components. </li></ul><ul><li>All these components are part of the Flex Software Development Kit (SDK). </li></ul>
  9. 9. The BlazeDS server <ul><li>The BlazeDS server runs in a J2EE application server. </li></ul><ul><li>Configure an existing J2EE web application to support BlazeDS:- </li></ul><ul><li>Add the BlazeDS JAR files and dependent JAR files to the WEB-INF/lib directory. </li></ul><ul><li>Edit the BlazeDS configuration files in the WEB-INF/flex directory. </li></ul><ul><li>Define MessageBrokerServlet in WEB-INF/web.xml. </li></ul>
  10. 10. Key Services of BlazeDS <ul><li>The Remoting Service allows our Flex application to directly invoke methods of Java object deployed in our application server. </li></ul><ul><li>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. </li></ul>
  11. 11. Contd… <ul><li>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. </li></ul><ul><li>Without having to deploy a crossdomain policy file on the target domain. </li></ul>
  12. 12. <ul><li>Now </li></ul><ul><li>Take a look of </li></ul><ul><li>Demo Application </li></ul>
  13. 13. Config file setting <ul><li>Finally, you must add the class destination in WEB-INF/flex/remoting-config.xml, </li></ul><ul><li><destination id=&quot;myJavaClass&quot; >         <properties>                 <source>MyRPC</source>                 <scope>application</scope>         </properties> </destination> </li></ul>
  14. 14. Description of Config <ul><li>The destination id attribute is referenced when you invoke the class from Flex. </li></ul><ul><li>The <source> node points to the fully qualified name of the Java class. i.e. packageName.className </li></ul><ul><li>The <scope> node determines when the Java class will be instantiated, </li></ul><ul><ul><li>Application means the class will be instantiated once during servlet initialization. </li></ul></ul><ul><ul><li>Session means the class is instantiated for each user session. </li></ul></ul><ul><ul><li>Request resets the class for each invocation. </li></ul></ul>
  15. 15. Client Side Coding <ul><li><mx:RemoteObject </li></ul><ul><li>id=&quot;myService&quot; </li></ul><ul><li> destination=&quot;myJavaClass&quot;> </li></ul><ul><li><mx:Button </li></ul><ul><li> click=&quot;myService.sayHello()&quot; /> </li></ul><ul><li><mx:Label text=&quot;{myService.sayHello.lastResult}&quot; </li></ul><ul><li>/> </li></ul>
  16. 16. <ul><li>QA Session </li></ul><ul><li>N </li></ul><ul><li>Thanks </li></ul>