Flash Remoting TechNote

How sessions work in JRun 4.0/J2EE and Flash Remoting

This TechNote provides information on how sessions work when creating a Macromedia Flash UI connecting to Flash Remoting in JRun4.0 and J2EE application servers.

How does Flash Remoting know when to maintain a stateful session?
The Flash Remoting (FR) gateway has adapters for each technology: ColdFusion MX, Java, and .NET. For Java, Flash Remoting has an adapter for EJB's (Enterprise JavaBeans), JavaBean's, JMX (Java Management Extensions) and Java classes. JavaBeans and EJB's can be stateful; Java classes and JMX can not. The JavaBean service adapter in the gateway checks your targeted service, to determine if a Java class is Serializable. Next, it verifies that the targeted service's fields are, in fact, Serializable. If both these cases are true, then it is capable of object streaming through HTTP sessions. Flash Remoting makes a blanket assumption that you want the service to be stateful to your client. Because of this—it will store the instance in your HTTP session.

Here is an example of how you would serialize your object:

public class MyBean implements Serializable {


How does Flash Remoting handle session ID's?
Flash Remoting will send the JSESSIONID parameter to the Flash movie. NetServices will append the session ID value to all subsequent HTTP requests.

What if the Java class is not Serializable?
On the other hand, if the targeted service is not Serializable, no state is maintained. In this case, the service is treated as a stateless Java class.

Which services can be stateful or stateless?
The following list of adapters in Flash Remoting indicates what state each can implement:

JavaBean Stateful must implement Serializable
Java class



Stateful, stateless, or Entity Beans can implement Serializable


Stateless (the JMX service only works with JRun 4.0)

The thing to note here is that by implementing Serializable, you are automatically enabling a stateful session which will cause the instance to be stored in your HTTP session.

Troubleshooting tips to consider if a stateful session is not working
If you are not able to maintain a stateful session, it is likely due to one of the following three reasons:

> You have not made your Java class Serializable

One of your fields are not Serializable


The service is not Serializable


Last updated: June 24, 2002
Created: May 24, 2002

ID: 16359
Product: Flash Remoting
Versions: All
OS: All
Browser: N/A
Server: N/A
Database: N/A
Former ID: N/A