Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to maintain Session in Swing application using StatefulsessionBean  RSS feed

 
Iftikhar Arain
Ranch Hand
Posts: 95
Flex Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi I am new to EJB.
I know how to maintain the session using web browser.
But I want to maintain the user session using Swing application as client which communicates with SatefulsessionBean.
Plz give me any example or url link for easy to understand.
Thanks in advanced
 
Chris Mathews
Ranch Hand
Posts: 2712
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My question is: Why not maintain the session state directly in your Swing Client?
I don't see any reason to off load Session Management to the server when you have a perfectly good thick client capable of handling it.
 
Byron Estes
Ranch Hand
Posts: 313
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Chris has a point, but I think you need to consider whether the "session related processes" could potentially be used by multiple client types (e.g. What if you wanted to supply a web based implementation too!), then you might consider establishing a business delegate with a service locator to communicate on the various clients behalf to a Stateful SessionBean that could be used to perform the state mainteance for all types of clients. If you believe that it is unlikely that you'll have muliple client types you might opt as Chris suggested to maintain state in the "thick" client. Most of the session stuff was primarily provided to help developers preserve information between HTTP requests.
 
Iftikhar Arain
Ranch Hand
Posts: 95
Flex Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your replys.
Actually I want to know how to maintain the session in Swing application like Web browser maintain the session with JSession ID in the url.But how to send the JSession Id in swing application.Because the Statefull Session bean works on the JSession ID.If I am wrong plz correct me b/c I am new in EJB.
I just want to use many java swing,awt applications as web browsers.
 
Byron Estes
Ranch Hand
Posts: 313
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
After you create the stateful session bean on the first request, you can save it's handle. The handle will allow you to reobtain a object reference to the client's stateful session bean (...as long as it hasn't expired, or the server was shutdown/crashed). You may have issues doing this if there is a firewall between the client and the server.
Hope this helps,
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!