1 16 package org.directwebremoting.impl; 17 18 import java.util.Collection ; 19 20 import javax.servlet.ServletConfig ; 21 import javax.servlet.ServletContext ; 22 23 import org.directwebremoting.Container; 24 import org.directwebremoting.ServerContext; 25 import org.directwebremoting.extend.ConverterManager; 26 import org.directwebremoting.extend.ScriptSessionManager; 27 import org.directwebremoting.util.VersionUtil; 28 29 33 public class DefaultServerContext implements ServerContext 34 { 35 41 public DefaultServerContext(ServletConfig config, ServletContext context, Container container) 42 { 43 this.config = config; 44 this.context = context; 45 this.container = container; 46 } 47 48 51 public Collection getAllScriptSessions() 52 { 53 return getScriptSessionManager().getAllScriptSessions(); 54 } 55 56 59 public Container getContainer() 60 { 61 return container; 62 } 63 64 67 public Collection getScriptSessionsByPage(String otherPage) 68 { 69 return getScriptSessionManager().getScriptSessionsByPage(otherPage); 70 } 71 72 75 public ServletConfig getServletConfig() 76 { 77 return config; 78 } 79 80 83 public ServletContext getServletContext() 84 { 85 return context; 86 } 87 88 91 public String getVersion() 92 { 93 return VersionUtil.getVersion(); 94 } 95 96 100 protected ScriptSessionManager getScriptSessionManager() 101 { 102 if (sessionManager == null) 103 { 104 sessionManager = (ScriptSessionManager) container.getBean(ScriptSessionManager.class.getName()); 105 } 106 107 return sessionManager; 108 } 109 110 114 protected ConverterManager getConverterManager() 115 { 116 if (converterManager == null) 117 { 118 converterManager = (ConverterManager) container.getBean(ConverterManager.class.getName()); 119 } 120 121 return converterManager; 122 } 123 124 127 private ServletConfig config = null; 128 129 132 private ServletContext context = null; 133 134 137 private Container container = null; 138 139 142 private ScriptSessionManager sessionManager = null; 143 144 147 private ConverterManager converterManager = null; 148 } 149 | Popular Tags |