Hey everyone, I am pretty new to Tapestry5 -- have been a user of Tapestry 4 for over 5 years though. Finally got the balls to upgrade to 5.
My question is in regards to how to integrate application state managers into my app in tapestry. I read http://tapestry.1045711.n5.nabble.com/Threading-and-SSOs-again-td3276880.html and http://tapestry.1045711.n5.nabble.com/Advice-on-Tapestry5-best-practise-for-user-session-data-td2398839.html and some basics from http://tapestry.apache.org/session-storage.html For some best practices/gotchas in designing my tapestry app. Basically when a user logs in, I want to have a place in session to store various things. The standard user information, recent history, etc. My application is tapestry with tynamo-security/shiro and spring/jpa as a backend. I don't have an application cache (like ehcache or memcached) setup yet as my app is still very early. But I am sure the things I want to store in my session are small I do want them in my session. and Is there anything wrong with this design: I create a service and inject into components and pages base class so they all can read/write to it public class UserStuff implements UserStuffService { @Inject private ApplicationStateManager asm; @Inject @Autowired private UserDao userDao; //some userDao from spring/jpa //UserSettings is a small POJO public synchronized UserSettings getUserSettings() {return asm.get(UserSettings.class);} public synchronized UserSettings setUserSettings(UserSettings us) {asm.set(UserSettings.class, us);} public void saveSettings() { UserSettings us = getUserSettings(); if (us == null) return; userDao.update(us); //update in db } public void loadSettings(String id) { User u = userDao.getUser(id); UserSettings us = new UserSettings(u); this.setUserSettings(us); } } then residing somewhere in api, I implement a shiro realm so: protected AuthenticationInfo doGetAuthenticationInfo(MyAuthenticationToken token) throws AuthenticationException { //do login stuff if (login is ok) { ApplicationStateManager asm = //somehow get this??? asm.loadSettings(token.getUserId()); } } So a couple of questions: 1. Is everything sound so far? 2. I can think of two possible ways to get the asm in doGetAuthenticationInfo above: a) inject it into my realm (is this possible and how do I do this?) b) get it from my MyAuthenticationToken -- ie on my login page I can set the asm in the token I created. Thanks in advance everyone! -- View this message in context: http://tapestry.1045711.n5.nabble.com/Services-and-ApplicationStateManager-tp4708974p4708974.html Sent from the Tapestry - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org