7 Replies Latest reply on Nov 15, 2010 5:12 AM by jfb00

    session management..

    ravi burila

      Hi,

         iam new to flex environment. I know java, as in java is there any session mangement in Flex.

       

      if so,

       

      how can i create session in flex, i am to use flex--java(remote objet)

      can you please provide me an small example.

        • 1. Re: session management..
          flex4 Level 2

          Hi

           

                Actually we dont have a sessions in flex side .. we have a shared objects in flex and that shared objects are like cookies.. the best way to maintain session is FlexContext class..

           

                         in java side u need to get the session through FlexContext class.. and assign this to HttpSessions.. i think this will help u .....

           

             u can store the user information in sharedobjects but u can not maintain sessions i think.. above is the best practise...

           

          Ram....

          • 2. Re: session management..
            BhaskerChari Level 4

            Hi Ravi,

             

            There is no need for you to create any sessoin in Flex side as Flex applications are functionally a lot more like client-server applications than they are web applications. Like desktop client-server applications, Flex applications are loaded and they remain running as long as the app is in use.

             

            You can check out the below link by reading which you can get a lot out of it.

             

            http://www.forta.com/blog/index.cfm/2006/9/24/flex-and-session-state-management

             

             

            Thanks,

            Bhasker Chari

            • 3. Re: session management..
              ravi burila Level 1

              thank for your reply

                                             but may i know how can i have logout in flex environment when i dont have session.

               

              thanks in advance

              • 4. Re: session management..
                flex4 Level 2

                Hi

                 

                   There are lot of ways to implement logout ... u can implement logout by removing all child and all catching objects in client side.. and all shared objects.. then

                when ever u loged in agin it will not take previous value.. it will take new value.. u can implement logout in this way.. give a navigation to login page and remove every thing childs and modules .  and stored objects...

                 

                Ram

                • 5. Re: session management..
                  jfb00 Level 3

                  Hi,

                  What about showing logout form after timeout the app for 20 minutes of not using the app.

                  Any examples up there?

                  Thanks

                   

                  Johnny

                  • 6. Re: session management..
                    BhaskerChari Level 4

                    @Jonny,

                     

                    You can make use of FlexEvent.IDLE ...

                     

                    Add the below event listener in either preInitialize or creationComplete of Application.

                    systemManager.addEventListener(FlexEvent.IDLE, userIdle);

                     

                    private function userIdle(e:FlexEvent):void
                    {
                          if(e.currentTarget.mx_internal::idleCounter == parseInt(model.employee.SessionTimeOut) * 600)
                          {

                                   logout();
                           }

                    }

                     

                    In the above 1 min = 600Ticks

                    model.employee.SessionTimeOut is the dynamic value in minutes...

                     

                    public function logout():void
                    {
                        var logout:URLRequest=new URLRequest("logout.html");
                        navigateToURL(logout,"_self");
                    }

                     

                    Thanks,

                    Bhasker

                    • 7. Re: session management..
                      jfb00 Level 3

                      That works Bhaster, thanks!!

                      Rgds

                       

                      Johnny