1 4 package javax.servlet.http; 5 6 import com.tc.exception.ImplementMe; 7 8 import java.io.BufferedReader ; 9 import java.security.Principal ; 10 import java.util.Enumeration ; 11 import java.util.Locale ; 12 import java.util.Map ; 13 14 import javax.servlet.RequestDispatcher ; 15 import javax.servlet.ServletInputStream ; 16 17 public class MockHttpServletRequest implements HttpServletRequest { 18 19 private final String contextPath; 20 private String requestUrl; 21 private HttpSession session; 22 private String requestedSessionId; 23 private boolean sidFromCookie; 24 private boolean sidValid; 25 private String scheme; 26 private String serverName; 27 private int serverPort; 28 29 public MockHttpServletRequest() { 30 this.contextPath = "/"; 31 } 32 33 public MockHttpServletRequest(String contextPath, String requestedSessionId) { 34 this.contextPath = contextPath; 35 this.requestedSessionId = requestedSessionId; 36 } 37 38 public void setSession(HttpSession session) { 39 this.session = session; 40 } 41 42 public void setRequestedSessionId(String requestedSessionId) { 43 this.requestedSessionId = requestedSessionId; 44 } 45 46 public void setRequestUrl(String requestUrl) { 47 this.requestUrl = requestUrl; 48 } 49 50 public void setSidFromCookie(boolean sidFromCookie) { 51 this.sidFromCookie = sidFromCookie; 52 } 53 54 public void setSidValid(boolean sidValid) { 55 this.sidValid = sidValid; 56 } 57 58 public void setScheme(String scheme) { 59 this.scheme = scheme; 60 } 61 62 public void setServerName(String serverName) { 63 this.serverName = serverName; 64 } 65 66 public void setServerPort(int serverPort) { 67 this.serverPort = serverPort; 68 } 69 70 public String getAuthType() { 71 throw new ImplementMe(); 72 } 73 74 public String getContextPath() { 75 return contextPath; 76 } 77 78 public Cookie [] getCookies() { 79 throw new ImplementMe(); 80 } 81 82 public long getDateHeader(String arg0) { 83 throw new ImplementMe(); 84 } 85 86 public String getHeader(String arg0) { 87 throw new ImplementMe(); 88 } 89 90 public Enumeration getHeaderNames() { 91 throw new ImplementMe(); 92 } 93 94 public Enumeration getHeaders(String arg0) { 95 throw new ImplementMe(); 96 } 97 98 public int getIntHeader(String arg0) { 99 throw new ImplementMe(); 100 } 101 102 public String getMethod() { 103 throw new ImplementMe(); 104 } 105 106 public String getPathInfo() { 107 throw new ImplementMe(); 108 } 109 110 public String getPathTranslated() { 111 throw new ImplementMe(); 112 } 113 114 public String getQueryString() { 115 throw new ImplementMe(); 116 } 117 118 public String getRemoteUser() { 119 throw new ImplementMe(); 120 } 121 122 public String getRequestURI() { 123 throw new ImplementMe(); 124 } 125 126 public StringBuffer getRequestURL() { 127 return new StringBuffer (requestUrl); 128 } 129 130 public String getRequestedSessionId() { 131 throw new ImplementMe(); 132 } 133 134 public String getServletPath() { 135 throw new ImplementMe(); 136 } 137 138 public HttpSession getSession() { 139 return getSession(true); 140 } 141 142 public HttpSession getSession(boolean create) { 143 if (!create && requestedSessionId == null) return session; 144 if (session == null) session = new MockHttpSession (requestedSessionId); 145 return session; 146 } 147 148 public Principal getUserPrincipal() { 149 throw new ImplementMe(); 150 } 151 152 public boolean isRequestedSessionIdFromCookie() { 153 return sidFromCookie; 154 } 155 156 public boolean isRequestedSessionIdFromURL() { 157 return !sidFromCookie; 158 } 159 160 public boolean isRequestedSessionIdFromUrl() { 161 return isRequestedSessionIdFromURL(); 162 } 163 164 public boolean isRequestedSessionIdValid() { 165 return sidValid; 166 } 167 168 public boolean isUserInRole(String arg0) { 169 throw new ImplementMe(); 170 } 171 172 public Object getAttribute(String arg0) { 173 throw new ImplementMe(); 174 } 175 176 public Enumeration getAttributeNames() { 177 throw new ImplementMe(); 178 } 179 180 public String getCharacterEncoding() { 181 throw new ImplementMe(); 182 } 183 184 public int getContentLength() { 185 throw new ImplementMe(); 186 } 187 188 public String getContentType() { 189 throw new ImplementMe(); 190 } 191 192 public ServletInputStream getInputStream() { 193 throw new ImplementMe(); 194 } 195 196 public String getLocalAddr() { 197 throw new ImplementMe(); 198 } 199 200 public String getLocalName() { 201 throw new ImplementMe(); 202 } 203 204 public int getLocalPort() { 205 throw new ImplementMe(); 206 } 207 208 public Locale getLocale() { 209 throw new ImplementMe(); 210 } 211 212 public Enumeration getLocales() { 213 throw new ImplementMe(); 214 } 215 216 public String getParameter(String arg0) { 217 throw new ImplementMe(); 218 } 219 220 public Map getParameterMap() { 221 throw new ImplementMe(); 222 } 223 224 public Enumeration getParameterNames() { 225 throw new ImplementMe(); 226 } 227 228 public String [] getParameterValues(String arg0) { 229 throw new ImplementMe(); 230 } 231 232 public String getProtocol() { 233 throw new ImplementMe(); 234 } 235 236 public BufferedReader getReader() { 237 throw new ImplementMe(); 238 } 239 240 public String getRealPath(String arg0) { 241 throw new ImplementMe(); 242 } 243 244 public String getRemoteAddr() { 245 throw new ImplementMe(); 246 } 247 248 public String getRemoteHost() { 249 throw new ImplementMe(); 250 } 251 252 public int getRemotePort() { 253 throw new ImplementMe(); 254 } 255 256 public RequestDispatcher getRequestDispatcher(String arg0) { 257 throw new ImplementMe(); 258 } 259 260 public String getScheme() { 261 return scheme; 262 } 263 264 public String getServerName() { 265 return serverName; 266 } 267 268 public int getServerPort() { 269 return serverPort; 270 } 271 272 public boolean isSecure() { 273 throw new ImplementMe(); 274 } 275 276 public void removeAttribute(String arg0) { 277 throw new ImplementMe(); 278 279 } 280 281 public void setAttribute(String arg0, Object arg1) { 282 throw new ImplementMe(); 283 284 } 285 286 public void setCharacterEncoding(String arg0) { 287 throw new ImplementMe(); 288 289 } 290 291 } 292 | Popular Tags |