2 Replies Latest reply on Sep 6, 2009 3:11 AM by paul.williams

    Accessing session variable in Flex.

    karnatis Level 1

      Hi All,


         I'm using RemoteObjects for accessing data and using Spring BlazeDS. How to retrieve 'session' variable values in Flex?


         Main application which is calling different .mxml files. It first invokes login(login.mxml) page with successful user credentials it will display home(home.mxml) page and I have search(search.mxml) pages.


          In case user session timeouts then I'd like to send user request to login page for login.(say user is in search page and where he left for 30 minutes, after then when user clicks anything on search page, it should redisplay login page because session timeout is set to (25 minutes).  How to do this Felx??


         Thanks in advance.




        • 1. Re: Accessing session variable in Flex.
          bryn51 Level 1

          More detail solution will be found in the help.

          Look for the following string in your local help (in flex builder): Communicating with the Wrapper.


          You will probably find that you have to do something like the following:


          a) call from flex to the wrapper page javascript function.  (this would be a polling operation, run on a timer event (say) once every minute.


          b) the javascript function you call conducts an Ajax call to determine the current session state.


          Note that the above will likely keep your session state alive.


          Another possibility is to pass in the value of your session timeout via a FlashVars variable.


          Again, in a timer function run every minute, invcrement a local counter.

          When local counter equals session passed in, then you might assume that the session has timed out.




          • 2. Re: Accessing session variable in Flex.
            paul.williams Level 4

            You cannot access the session directly in Flex because it is managed on

            the server. However, you can access it from your java remote objects

            using the FlexHttpSession class and then pass information back to the