12 Replies Latest reply on Dec 19, 2010 10:06 AM by cartman1138

    Flex session using blazeds?

    saisri2k2 Level 4

      Hello,

       

      Need help on managing the Flex session using blazeds. If source is available, it would help a lot.

        • 1. Re: Flex session using blazeds?
          UbuntuPenguin Level 4

          You haven't asked a specific question ...?

          • 2. Re: Flex session using blazeds?
            saisri2k2 Level 4

            Will be session managment, like if a user logsin and everytime he makes a request, his session should be validated like we do in pure J2EE using session objects. If the session is timed out, how to redirect the user to a differnt url etc., using blazeds.

            • 3. Re: Flex session using blazeds?
              UbuntuPenguin Level 4

              Thats more of a question for a Java forum.  You can still use regular sessions for Flex, they even have a FlexSession class somewhere in the

              Blazeds api.  But as far as validation and redirecting, those questions can't really be answered in a Flex forum ( or at least I wouldn't start here ).

              • 4. Re: Flex session using blazeds?
                saisri2k2 Level 4

                any help?

                • 5. Re: Flex session using blazeds?
                  cartman1138 Level 1

                  You can get the HttpResponse with FlexContext.getHttpResponse(). Then you could to the redirect. I'm not sure that is what you want to do. It might be better to throw an exception and let Flex catch it. Then you could take corrective action on the client, like login.

                   

                   

                  public class xyz extends EventDispatcher {

                          public var service:RemoteObject;

                   

                   

                          public function execute (event : CommonEvent) : void {

                   

                              AsyncToken token = service.doSomthing( event.user );

                             token.addResponder( this );

                   

                          }

                   

                          public function result (event:*) : void {

                   

                              Alert.show( "YES!!!!" );

                   

                          }

                   

                   

                   

                          public function error (fault:Fault) : void {

                   

                              Alert.show( "No!!!!" );

                   

                          }

                   

                   

                      }

                  1 person found this helpful
                  • 6. Re: Flex session using blazeds?
                    BhaskerChari Level 4

                    Hi saisri2k2,

                     

                    Instead of making use of Server side session you can make a logic of your own at the client side itself by making use of the FlexEvent.IDLE and doing the appropriate action accordingly.

                     

                    You can google for the FlexEvent.IDLE  keyword. So if the user stays idle for a particular time you can register a check in the eventListener registerd for FlexEvent.IDLE and navigate or redirect user to another page.

                     

                     

                    Thanks,

                    Bhasker

                    • 7. Re: Flex session using blazeds?
                      saisri2k2 Level 4

                      Well, I'm wondering on the issues like when the object and how long does the object will be created per requrest  of method of the user ? In Java Spring, we have a way to keep the object alive for a session, application, per request and other types. do we have the same type of control in the blazeds?

                      • 8. Re: Flex session using blazeds?
                        cartman1138 Level 1

                        The FlexSession is a non-JEE analogof HttpSession. Also you can access the HttpSession if needed. If you are using Spring then there is a blazeDS integration so that you can tie into the Spring login. Then Spring will take care of the authentication and authorization.

                        • 9. Re: Flex session using blazeds?
                          saisri2k2 Level 4

                          Well, the other day, i was trying this on my pep project

                           

                          opened the application > logged in > restarted the server after my app is loaded > now make a request on flex to the server > server gave me the response back to me without asking me to log in again

                           

                          I've heard that blzeds maintains the sessions internally, atlest it has to throw a fault rite in this case?(after the server restart). Do we have to mnage the sessions manully?

                           

                          Message was edited by: saisri2k2

                          • 10. Re: Flex session using blazeds?
                            cartman1138 Level 1

                            I'm missing something. Are you using container managed security or storing a token in the session? I think a quick stroll through the code might help understand this better. Take a look at the source: flex.messaging.FlexContext, flex.messaging.FlexSession.

                            • 11. Re: Flex session using blazeds?
                              saisri2k2 Level 4

                              You mean spring container security? So, what is the right way to do it now? should I store the authentication information in the flexsession and check if it is existing in every request that the client makes.. if it is absent then throw an error?

                              • 12. Re: Flex session using blazeds?
                                cartman1138 Level 1

                                Sorry, forgot you were using Spring. You can annotate each method to set the required "role". Then Spring BlazeDS integration will take care of making sure they are allowed to access that method. The BlazeDS integration is a whole other topic though. The latest stable BlazeDS turnkey download comes with an exaple of Spring integration. Start there. There are some pretty good doc at springsource http://www.springsource.org/spring-flex.

                                1 person found this helpful