1 9 package org.jboss.portal.portlet.impl; 10 11 import java.io.BufferedReader ; 12 import java.io.IOException ; 13 import java.io.UnsupportedEncodingException ; 14 import java.security.Principal ; 15 import java.util.Enumeration ; 16 import java.util.Locale ; 17 import java.util.Map ; 18 19 import javax.portlet.RenderRequest; 20 import javax.servlet.RequestDispatcher ; 21 import javax.servlet.ServletInputStream ; 22 import javax.servlet.http.Cookie ; 23 import javax.servlet.http.HttpServletRequest ; 24 import javax.servlet.http.HttpSession ; 25 26 import org.jboss.portal.server.PortalRequest; 27 28 32 public class DispatchedHttpServletRequest implements HttpServletRequest 33 { 34 35 private PortalRequest preq; 36 private RenderRequest rreq; 37 private HttpServletRequest hreq; 38 39 private final String servletPath; 40 private final String pathInfo; 41 private final String queryString; 42 private final String requestURI; 43 44 public DispatchedHttpServletRequest( 45 PortalRequest preq, 46 RenderRequest rreq, 47 HttpServletRequest hreq, 48 String path) 49 { 50 this.preq = preq; 51 this.rreq = rreq; 52 this.hreq = hreq; 53 if (path != null) 54 { 55 int endOfServletPath = path.indexOf('/', 1); 56 if (endOfServletPath == -1) 57 { 58 endOfServletPath = path.indexOf('?', 1); 59 if (endOfServletPath == -1) 60 { 61 this.servletPath = path; 62 this.pathInfo = ""; 63 this.queryString = ""; 64 } 65 else 66 { 67 this.servletPath = path.substring(0, endOfServletPath); 68 this.pathInfo = ""; 69 this.queryString = path.substring(endOfServletPath + 1); 70 } 71 } 72 else 73 { 74 this.servletPath = path.substring(0, endOfServletPath); 75 int endOfPathInfo = path.indexOf('?', endOfServletPath + 1); 76 if (endOfPathInfo == -1) 77 { 78 this.pathInfo = path.substring(endOfServletPath); 79 this.queryString = ""; 80 } 81 else 82 { 83 this.pathInfo = path.substring(endOfServletPath, endOfPathInfo); 84 this.queryString = path.substring(endOfPathInfo + 1); 85 } 86 } 87 this.requestURI = getContextPath() + servletPath + pathInfo; 88 } 89 else 90 { 91 servletPath = null; 92 pathInfo = null; 93 queryString = null; 94 requestURI = null; 95 } 96 } 97 98 100 public String getProtocol() 101 { 102 return null; 103 } 104 105 public String getRemoteAddr() 106 { 107 return null; 108 } 109 110 public String getRemoteHost() 111 { 112 return null; 113 } 114 115 public String getRealPath(String s) 116 { 117 return null; 118 } 119 120 public StringBuffer getRequestURL() 121 { 122 return null; 123 } 124 125 127 public String getPathInfo() 128 { 129 return pathInfo; 130 } 131 132 public String getQueryString() 133 { 134 return queryString; 135 } 136 137 public String getServletPath() 138 { 139 return servletPath; 140 } 141 142 public String getRequestURI() 143 { 144 return requestURI; 145 } 146 147 public String getPathTranslated() 148 { 149 return "PathTranslated"; } 151 152 154 public String getScheme() 155 { 156 return rreq.getScheme(); 157 } 158 159 public String getServerName() 160 { 161 return rreq.getServerName(); 162 } 163 164 public int getServerPort() 165 { 166 return rreq.getServerPort(); 167 } 168 169 public Object getAttribute(String s) 170 { 171 return rreq.getAttribute(s); 172 } 173 174 public Enumeration getAttributeNames() 175 { 176 return rreq.getAttributeNames(); 177 } 178 179 public void setAttribute(String s, Object o) 180 { 181 rreq.setAttribute(s, o); 182 } 183 184 public void removeAttribute(String s) 185 { 186 rreq.removeAttribute(s); 187 } 188 189 public Locale getLocale() 190 { 191 return rreq.getLocale(); 192 } 193 194 public Enumeration getLocales() 195 { 196 return rreq.getLocales(); 197 } 198 199 public boolean isSecure() 200 { 201 return rreq.isSecure(); 202 } 203 204 public String getAuthType() 205 { 206 return rreq.getAuthType(); 207 } 208 209 public String getContextPath() 210 { 211 return rreq.getContextPath(); 212 } 213 214 public String getRemoteUser() 215 { 216 return rreq.getRemoteUser(); 217 } 218 219 public Principal getUserPrincipal() 220 { 221 return rreq.getUserPrincipal(); 222 } 223 224 public String getRequestedSessionId() 225 { 226 return rreq.getRequestedSessionId(); 227 } 228 229 public boolean isRequestedSessionIdValid() 230 { 231 return rreq.isRequestedSessionIdValid(); 232 } 233 234 236 public String getParameter(String s) 237 { 238 return rreq.getParameter(s); 239 } 240 241 public Enumeration getParameterNames() 242 { 243 return rreq.getParameterNames(); 244 } 245 246 public String [] getParameterValues(String s) 247 { 248 return rreq.getParameterValues(s); 249 } 250 251 public Map getParameterMap() 252 { 253 return rreq.getParameterMap(); 254 } 255 256 258 public String getCharacterEncoding() 259 { 260 return null; 261 } 262 263 public void setCharacterEncoding(String s) throws UnsupportedEncodingException 264 { 265 } 266 267 public int getContentLength() 268 { 269 return 0; 270 } 271 272 public String getContentType() 273 { 274 return null; 275 } 276 277 public ServletInputStream getInputStream() throws IOException 278 { 279 return null; 280 } 281 282 public BufferedReader getReader() throws IOException 283 { 284 return null; 285 } 286 287 289 public String getHeader(String s) 290 { 291 return null; 292 } 293 294 public Enumeration getHeaders(String s) 295 { 296 return null; 297 } 298 299 public Enumeration getHeaderNames() 300 { 301 return null; 302 } 303 304 public Cookie [] getCookies() 305 { 306 return new Cookie [0]; 307 } 308 309 public long getDateHeader(String s) 310 { 311 return 0; 312 } 313 314 public int getIntHeader(String s) 315 { 316 return 0; 317 } 318 319 321 public String getMethod() 322 { 323 return "GET"; 325 } 326 327 public RequestDispatcher getRequestDispatcher(String s) 328 { 329 return preq.getRequestDispatcher(s); 330 } 331 332 public boolean isUserInRole(String s) 333 { 334 return false; 335 } 336 337 public HttpSession getSession(boolean b) 338 { 339 return hreq.getSession(b); 340 } 341 342 public HttpSession getSession() 343 { 344 return hreq.getSession(); 345 } 346 347 public boolean isRequestedSessionIdFromCookie() 348 { 349 return false; 350 } 351 352 public boolean isRequestedSessionIdFromURL() 353 { 354 return false; 355 } 356 357 public boolean isRequestedSessionIdFromUrl() 358 { 359 return false; 360 } 361 362 364 public int getRemotePort() 365 { 366 throw new UnsupportedOperationException ("Not specified by spec"); 367 } 368 369 public String getLocalName() 370 { 371 throw new UnsupportedOperationException ("Not specified by spec"); 372 } 373 374 public String getLocalAddr() 375 { 376 throw new UnsupportedOperationException ("Not specified by spec"); 377 } 378 379 public int getLocalPort() 380 { 381 throw new UnsupportedOperationException ("Not specified by spec"); 382 } 383 } 384 | Popular Tags |