1 Reply Latest reply on Jul 11, 2007 2:15 PM by Newsgroup_User

    Flex Data Services + java server sessions

    scabbage
      Hello, folks,

      I am developing a Java application and realized that I need some advice. My application is simple:

      I have
      * a PostgreSQL server with GIS data I want to display on Google Earth
      * Tomcat 5.5
      * Flex Data Services

      Basically, I need to query and create 10000+ GIS data objects from the DB and store them in the server memory. A Flex client then uses Remote Object Service to access the properties of all the objects. A user will choose which objects to be displayed and this info is send back to the server. The server then compiles a KML file according to the user's pick. As KML allows user to send updates by only sending the diff KML, this makes it easy to turn the visibility of a small number of objects on and off.

      My problem is, I do not know a way to keep a session in the server memory. I need to find a way to store all the objects in the server memory so that I can keep track of the state (displayed or not displayed) of each object. All the tutorials I Googled only give examples of how you can update changes to the DB. But that's not what I want. I only want to make one giant DB query at the beginning of the session and stores the result in memory. This way, I can change the state of each object on the fly.

      So please give me some suggestions on this.

      Thanks.
        • 1. Re: Flex Data Services + java erver sessions
          Level 7
          Are you using RemoteObject?

          You could change the <scope> property of your remoting-service destination
          to be the session scope so that the same instance of the RemoteObject source
          would be used for the entire session. That way you could store the result
          as a member variable.

          Alternatively, you could get access to the session from the flex.messaging.FlexContext.getFlexSession()
          method and store the data in an attribute on the session?