6 Replies Latest reply on Apr 14, 2008 12:30 AM by pmuir

    Share Stateful session bean between web and applet

    ever

      Hello,


      I am not sure if the idea I have is right because I did not find any information regarding this situation.


      I have the following situation:


      A user is on a website which contains a JSF table and a javaApplet.


      The user is manipulating the table ans sees the results of the actual table visual in the java applet.


      The java applet need to have access to the list value in the Stateful session bean.


      The applet can get the session id from the website and pass is to the server.


      My problem is how to get the stateful bean which is bound to the session XY? or is my approach to do so wrong?



      Thank you and Greetings!



        • 1. Re: Share Stateful session bean between web and applet
          ever

          What is in general the best solution when different technologies access the same context.


          Logically the the HTML content and applet belong to the same conversation and the same session.  It make sense that they could access the same stateful bean.. the only difference is in the way they do it...SOAP and JSF


          Did I maybe overlook something about this type of realization???



          Would be thankful for any hint



          Best regards

          • 2. Re: Share Stateful session bean between web and applet
            tom_goring

            Hi,


            I'm not sure how you are going to get this to work.
            The applet is running in the client JVM and so you won't be able to use any seam context there.  When your applet talks to the server it will be over some kind of remote interface and will bypass the JSF stuff and so I'm not sure how seam will know where this request is coming from.


            I suggest



            1. do you really need an applet ? have you looked at the richfaces controls?

            2. Jump though some hoops on the remote side to tie your sessions back together.



            I'm no applet expert though !

            • 3. Re: Share Stateful session bean between web and applet
              ever

              unfortunately I can't use JavaScriptor richfaces because the java applet is already there and quite complex... (visual graph)



              So my question is how can I share the content of s session bean between applications? or how can I access a SFSB Component.getInstance(seesionID,cid).


              The general problem about SFSB is that they are not multi threaded each thread has its own SFSB.



              One vague idea I have is to wrap the content of the SFSB bean (a List) to a Message Driven Bean along with session id and cid. The applet which is connected via SOAP to jboss will pass seesion id and cid to the webservice and get the content.


              Question: What alternatives do I have, if I would like to share the content of a SFSB with other sessions?

              • 4. Re: Share Stateful session bean between web and applet
                tom_goring

                If your using web services for your applet communication read chapter 20 in the seam manual:


                20.2. Conversational Web Services


                Maybe that will help you ?

                • 5. Re: Share Stateful session bean between web and applet
                  ever

                  thank you !


                  If I use the description from the manual I end with the situation having two SFSB containing two different lists. two sessions that are separated from each other.


                  I need to find a way to share the same content in one SFSB between applet and JSF.


                  can somebody give a hint on realization of this? is the approach via MDB and JMS the only way?



                  thank you...








                  • 6. Re: Share Stateful session bean between web and applet
                    pmuir

                    This isn't really related to Seam in anyway - if you can share the session between the browser and the applet, then that is fine (and  you'll need to find out how to do this), otherwise, the applet and the browser will be in different sessions and you would be best making the lists stateless.