1 4 package dwr; 5 6 import org.wings.session.SessionManager; 7 import org.wings.session.Session; 8 9 import uk.ltd.getahead.dwr.ExecutionContext; 10 11 15 public class CallableManager 16 { 17 SessionCreatorManager creatorManager = new SessionCreatorManager(); 18 19 public static CallableManager getInstance() { 20 CallableManager callableManager = (CallableManager)SessionManager.getSession().getProperty("CallableManager"); 21 if (callableManager == null) { 22 callableManager = new CallableManager(); 23 SessionManager.getSession().setProperty("CallableManager", callableManager); 24 } 25 return callableManager; 26 } 27 28 public void registerCallable(String scriptName, Object callable) { 29 Session session = SessionManager.getSession(); 30 ExecutionContext.setExecutionContext(session.getServletRequest(), session.getServletResponse(), null); 31 creatorManager.addCreator(scriptName, callable); 32 ExecutionContext.unset(); 33 } 34 35 public void unregisterCallable(String scriptName) { 36 Session session = SessionManager.getSession(); 37 ExecutionContext.setExecutionContext(session.getServletRequest(), session.getServletResponse(), null); 38 creatorManager.removeCreator(scriptName); 39 ExecutionContext.unset(); 40 } 41 } 42 | Popular Tags |