1 16 package uk.ltd.getahead.dwr; 17 18 import java.io.IOException ; 19 import java.util.Collection ; 20 21 import javax.servlet.ServletConfig ; 22 import javax.servlet.ServletContext ; 23 import javax.servlet.ServletException ; 24 import javax.servlet.http.HttpServletRequest ; 25 import javax.servlet.http.HttpServletResponse ; 26 import javax.servlet.http.HttpSession ; 27 28 import org.directwebremoting.Container; 29 import org.directwebremoting.ScriptSession; 30 31 36 public class WebContextFactory 37 { 38 44 public static WebContext get() 45 { 46 org.directwebremoting.WebContext wctx = org.directwebremoting.WebContextFactory.get(); 47 return new ProxyWebContext(wctx); 48 } 49 50 55 private static final class ProxyWebContext implements uk.ltd.getahead.dwr.WebContext 56 { 57 60 public ProxyWebContext(org.directwebremoting.WebContext proxy) 61 { 62 this.proxy = proxy; 63 } 64 65 68 public String forwardToString(String url) throws ServletException , IOException 69 { 70 return proxy.forwardToString(url); 71 } 72 73 76 public Collection getAllScriptSessions() 77 { 78 return proxy.getAllScriptSessions(); 79 } 80 81 84 public Container getContainer() 85 { 86 return proxy.getContainer(); 87 } 88 89 92 public String getCurrentPage() 93 { 94 return proxy.getCurrentPage(); 95 } 96 97 100 public HttpServletRequest getHttpServletRequest() 101 { 102 return proxy.getHttpServletRequest(); 103 } 104 105 108 public HttpServletResponse getHttpServletResponse() 109 { 110 return proxy.getHttpServletResponse(); 111 } 112 113 116 public ScriptSession getScriptSession() 117 { 118 return proxy.getScriptSession(); 119 } 120 121 124 public Collection getScriptSessionsByPage(String url) 125 { 126 return proxy.getScriptSessionsByPage(url); 127 } 128 129 132 public ServletConfig getServletConfig() 133 { 134 return proxy.getServletConfig(); 135 } 136 137 140 public ServletContext getServletContext() 141 { 142 return proxy.getServletContext(); 143 } 144 145 148 public HttpSession getSession() 149 { 150 return proxy.getSession(); 151 } 152 153 156 public HttpSession getSession(boolean create) 157 { 158 return proxy.getSession(create); 159 } 160 161 164 public String getVersion() 165 { 166 return proxy.getVersion(); 167 } 168 169 172 public void setCurrentPageInformation(String page, String scriptSessionId) 173 { 174 proxy.setCurrentPageInformation(page, scriptSessionId); 175 } 176 177 180 private org.directwebremoting.WebContext proxy; 181 } 182 } 183 | Popular Tags |