1 9 package org.jboss.portal.server.impl.invocation; 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.servlet.RequestDispatcher ; 20 import javax.servlet.ServletInputStream ; 21 import javax.servlet.http.Cookie ; 22 import javax.servlet.http.HttpServletRequest ; 23 import javax.servlet.http.HttpSession ; 24 25 import org.apache.log4j.Logger; 26 import org.jboss.portal.server.PortalRequest; 27 import org.jboss.portal.server.PortalServer; 28 import org.jboss.portal.server.ServerObject; 29 import org.jboss.portal.server.ServerURL; 30 import org.jboss.portal.server.Portal; 31 import org.jboss.portal.server.invocation.AttachmentKey; 32 import org.jboss.portal.server.util.Parameters; 33 import org.jboss.portal.server.util.Properties; 34 35 45 public class PortalRequestImpl implements PortalRequest 46 { 47 48 protected static final Logger log = Logger.getLogger(PortalRequestImpl.class); 49 50 51 protected final HttpServletRequest req; 52 53 54 protected final InvocationImpl invocation; 55 56 57 protected final Properties properties; 58 59 60 protected Boolean idempotent; 61 62 public PortalRequestImpl(HttpServletRequest req, InvocationImpl invocation) 63 { 64 this.req = req; 65 this.invocation = invocation; 66 this.properties = new Properties(); 67 } 68 69 71 public PortalServer getServer() 72 { 73 return invocation.container; 74 } 75 76 public Parameters getControlParameters() 77 { 78 return invocation.controlParameters; 79 } 80 81 public Parameters getTargetParameters() 82 { 83 return invocation.targetParameters; 84 } 85 86 public ServerObject getTarget() 87 { 88 return invocation.target; 89 } 90 91 public ServerURL getURL() 92 { 93 return invocation.url; 94 } 95 96 public Properties getProperties() 97 { 98 return properties; 99 } 100 101 public Boolean getIdempotent() 102 { 103 return idempotent; 104 } 105 106 public void setIdempotent(Boolean idempotent) 107 { 108 this.idempotent = idempotent; 109 } 110 111 public Portal getPortal() 112 { 113 return (Portal)invocation.getAttachment(AttachmentKey.PORTAL); 114 } 115 116 118 public String getAuthType() 119 { 120 return req.getAuthType(); 121 } 122 123 public String getContextPath() 124 { 125 return req.getContextPath(); 126 } 127 128 public Cookie [] getCookies() 129 { 130 return req.getCookies(); 131 } 132 133 public long getDateHeader(String key) 134 { 135 return req.getDateHeader(key); 136 } 137 138 public String getHeader(String key) 139 { 140 return req.getHeader(key); 141 } 142 143 public Enumeration getHeaderNames() 144 { 145 return req.getHeaderNames(); 146 } 147 148 public Enumeration getHeaders(String key) 149 { 150 return req.getHeaders(key); 151 } 152 153 public int getIntHeader(String key) 154 { 155 return req.getIntHeader(key); 156 } 157 158 public String getMethod() 159 { 160 return req.getMethod(); 161 } 162 163 public String getPathInfo() 164 { 165 return req.getPathInfo(); 167 } 168 169 public String getPathTranslated() 170 { 171 return req.getPathTranslated(); 172 } 173 174 public String getQueryString() 175 { 176 return req.getQueryString(); 177 } 178 179 public String getRemoteUser() 180 { 181 return req.getRemoteUser(); 182 } 183 184 public String getRequestedSessionId() 185 { 186 return req.getRequestedSessionId(); 187 } 188 189 public String getRequestURI() 190 { 191 return getContextPath() + getServletPath() + getPathInfo(); 192 } 193 194 public StringBuffer getRequestURL() 195 { 196 throw new UnsupportedOperationException ("todo"); 197 } 198 199 public String getServletPath() 200 { 201 return req.getServletPath(); 202 } 203 204 public HttpSession getSession() 205 { 206 return req.getSession(); 207 } 208 209 public HttpSession getSession(boolean b) 210 { 211 return req.getSession(b); 212 } 213 214 public Principal getUserPrincipal() 215 { 216 return req.getUserPrincipal(); 217 } 218 219 public boolean isRequestedSessionIdFromCookie() 220 { 221 return req.isRequestedSessionIdFromCookie(); 222 } 223 224 public boolean isRequestedSessionIdFromURL() 225 { 226 return req.isRequestedSessionIdFromURL(); 227 } 228 229 public boolean isRequestedSessionIdFromUrl() 230 { 231 return req.isRequestedSessionIdFromUrl(); 232 } 233 234 public boolean isRequestedSessionIdValid() 235 { 236 return req.isRequestedSessionIdValid(); 237 } 238 239 public boolean isUserInRole(String key) 240 { 241 return req.isUserInRole(key); 242 } 243 244 246 public Object getAttribute(String key) 247 { 248 return req.getAttribute(key); 249 } 250 251 public Enumeration getAttributeNames() 252 { 253 return req.getAttributeNames(); 254 } 255 256 public String getCharacterEncoding() 257 { 258 return req.getCharacterEncoding(); 259 } 260 261 public int getContentLength() 262 { 263 return req.getContentLength(); 264 } 265 266 public String getContentType() 267 { 268 return req.getContentType(); 269 } 270 271 public ServletInputStream getInputStream() throws IOException 272 { 273 return req.getInputStream(); 274 } 275 276 public String getLocalAddr() 277 { 278 return req.getLocalAddr(); 279 } 280 281 public Locale getLocale() 282 { 283 return req.getLocale(); 284 } 285 286 public Enumeration getLocales() 287 { 288 return req.getLocales(); 289 } 290 291 public String getLocalName() 292 { 293 return req.getLocalName(); 294 } 295 296 public int getLocalPort() 297 { 298 return req.getLocalPort(); 299 } 300 301 public String getParameter(String key) 302 { 303 return req.getParameter(key); 304 } 305 306 public Map getParameterMap() 307 { 308 return req.getParameterMap(); 309 } 310 311 public Enumeration getParameterNames() 312 { 313 return req.getParameterNames(); 314 } 315 316 public String [] getParameterValues(String key) 317 { 318 return req.getParameterValues(key); 319 } 320 321 public String getProtocol() 322 { 323 return req.getProtocol(); 324 } 325 326 public BufferedReader getReader() throws IOException 327 { 328 return req.getReader(); 329 } 330 331 public String getRealPath(String key) 332 { 333 return req.getRealPath(key); 334 } 335 336 public String getRemoteAddr() 337 { 338 return req.getRemoteAddr(); 339 } 340 341 public String getRemoteHost() 342 { 343 return req.getRemoteHost(); 344 } 345 346 public int getRemotePort() 347 { 348 return req.getRemotePort(); 349 } 350 351 public RequestDispatcher getRequestDispatcher(String key) 352 { 353 return req.getRequestDispatcher(key); 354 } 355 356 public String getScheme() 357 { 358 return req.getScheme(); 359 } 360 361 public String getServerName() 362 { 363 return req.getServerName(); 364 } 365 366 public int getServerPort() 367 { 368 return req.getServerPort(); 369 } 370 371 public boolean isSecure() 372 { 373 return req.isSecure(); 374 } 375 376 public void removeAttribute(String key) 377 { 378 req.removeAttribute(key); 379 } 380 381 public void setAttribute(String key, Object o) 382 { 383 req.setAttribute(key, o); 384 } 385 386 public void setCharacterEncoding(String key) throws UnsupportedEncodingException 387 { 388 req.setCharacterEncoding(key); 389 } 390 391 393 415 } 416 | Popular Tags |