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 import org.directwebremoting.WebContext; 31 import org.directwebremoting.WebContextFactory; 32 33 38 public class ExecutionContext implements WebContext 39 { 40 45 private ExecutionContext(WebContext proxy) 46 { 47 this.proxy = proxy; 48 } 49 50 53 public HttpSession getSession() 54 { 55 return proxy.getSession(); 56 } 57 58 61 public HttpSession getSession(boolean create) 62 { 63 return proxy.getSession(create); 64 } 65 66 69 public ServletConfig getServletConfig() 70 { 71 return proxy.getServletConfig(); 72 } 73 74 77 public ServletContext getServletContext() 78 { 79 return proxy.getServletContext(); 80 } 81 82 85 public HttpServletRequest getHttpServletRequest() 86 { 87 return proxy.getHttpServletRequest(); 88 } 89 90 93 public HttpServletResponse getHttpServletResponse() 94 { 95 return proxy.getHttpServletResponse(); 96 } 97 98 101 public String forwardToString(String url) throws ServletException , IOException 102 { 103 return proxy.forwardToString(url); 104 } 105 106 109 public String getVersion() 110 { 111 return proxy.getVersion(); 112 } 113 114 117 public ScriptSession getScriptSession() 118 { 119 throw new UnsupportedOperationException ("Use WebContextFactory.get().getPage()"); 120 } 121 122 125 public Collection getAllScriptSessions() 126 { 127 throw new UnsupportedOperationException ("Use WebContextFactory.get().getAllScriptSessions()"); 128 } 129 130 133 public Collection getScriptSessionsByPage(String page) 134 { 135 throw new UnsupportedOperationException ("Use WebContextFactory.get().getScriptSessionsByPage()"); 136 } 137 138 141 public Container getContainer() 142 { 143 throw new UnsupportedOperationException ("Use WebContextFactory.get().getContainer()"); 144 } 145 146 149 public void setCurrentPageInformation(String page, String scriptSessionId) 150 { 151 throw new UnsupportedOperationException ("Use WebContextFactory.get().setPageAndSessionIds()"); 152 } 153 154 157 public String getCurrentPage() 158 { 159 throw new UnsupportedOperationException ("Use WebContextFactory.get().toJavascript()"); 160 } 161 162 168 public static ExecutionContext get() 169 { 170 WebContext context = WebContextFactory.get(); 171 if (context == null) 172 { 173 return null; 174 } 175 176 return new ExecutionContext(context); 177 } 178 179 182 private WebContext proxy = null; 183 } 184 | Popular Tags |