Calling Java classes or JavaBeans from ActionScript
121
You can use a value object to send a coarse-grained view of data to the server and get back
fine-grained data. For example, you can call a single method on a value object that aggregates
several method calls on an entity bean. The method result is returned to the Flash application as
an ActionScript result object from which you can access data locally. This pattern can help to
reduce network traffic and response time, and to reduce the load on EJBs. For more information
about the value object pattern, go to
www.java.sun.com/blueprints/patterns/j2ee_patterns/
value_object/index.html
.
You can use a session facade to provide a single point of contact to a set of EJBs. For example, you
can call methods on a session bean (the session facade) that is capable of calling various methods
on several other EJBs, depending on the user’s current context in the application. This pattern
reduces network traffic and makes it easier to support different types of clients, change the
enterprise data model, or change the server implementation. For more information about the
session facade pattern, go to
www.java.sun.com/blueprints/patterns/j2ee_patterns/session_facade/
index.html
.
Calling Java classes or JavaBeans from ActionScript
This section describes how to call a JavaBean or Java class from Flash using Flash Remoting.
There is only one significant difference in how Flash Remoting handles standard Java classes and
JavaBeans. A Java class is stateless, and a new object instance is created whenever a method is
invoked. A JavaBean is stateful in the user’s HTTP session. Using a JavaBean with Flash
Remoting is similar to using the
jsp:useBean
tag in a JSP. Flash Remoting sends a
JSESSIONID
parameter to the Flash application, and the Service appends the session ID value to all subsequent
HTTP requests.
Note:
The Flash Remoting session is independent of HTTPSession objects available to JSPs and
servlets. A stateful JavaBean instantiated through Flash Remoting cannot access an object stored in
a session by a JSP or servlet. Conversely, a JSP or servlet cannot use its session to access a
JavaBean instantiated through Flash Remoting.
Making a Java class or JavaBean available to Flash Remoting
To call a standard Java class or JavaBean with Flash Remoting, you must make the class or bean
available in the classpath of the Flash Remoting gateway. Unless the class or bean is in the same
web application as the gateway, you typically add it to the system classpath.
Содержание FLASH REMOTING MX-USING FLASH REMOTING FOR FLASH MX 2004 ACTIONSCRIPT...
Страница 1: ...Using Flash Remoting for Flash MX 2004 ActionScript 2 0...
Страница 8: ...8 Contents...
Страница 62: ...62 Chapter 3 Using the RemotingConnector component Flash Professional only...
Страница 142: ...142 Chapter 7 Using Flash Remoting for Java...