Re: [JStateMachine-users] Session values
Brought to you by:
dixitsandeep,
pcauto
|
From: Brian O'B. <bo...@io...> - 2002-05-19 20:35:53
|
Robson, With the current interfaces, it will probably depend on which session manager package you are using. The org.jstatemachine.sessionmanagers.servlet.UserSession class includes the getHttpSession() method, that allows you access the HttpSession that is in scope. This in turn gives you the standard Servlet API methods to put objects in the session context. The org.jstatemachine.sessionmanagers.inmemory.UserSession class does not include anything you can use as it stands. It would, however, be trivial to extend that class to include the data you require. You would need to create the new class, and modify the UserSessionManager to create your new class. Alternatively, I could add something to the IUserSession interface, such as getProperties / setProperties, and then implement that in both the current session manager packages. Finally, there is a way you could do it with the current framework unchanged, though it is a bit of a hack: After authentication is complete, add the authentication token to the ResponseData. On each subsequent request, call getHistoryStar from your Controller, passing in the application root state. Retrieve the authentication token and check it. If it passes, add it to the new ResponseData and continue. If it fails, the Controller can throw a StateMachineUserException, forcing the UI into an exception state that is outside the authenticated area of your application. Let me know how it works, and I will look at adding something to the IUserSession interface for the next release. Thanks, Brian. On 18 May 2002, at 11:02, Robson Miranda wrote: > Hi, > > I'm beginning to use the JStateMachine framework, and I have one > doubt: how can I put some values to be used during all the states > visiteds by one user (such as the user identification)? > > Robson. > > |