001: /*
002: * Copyright 2003-2006 Rick Knowles <winstone-devel at lists sourceforge net>
003: * Distributed under the terms of either:
004: * - the common development and distribution license (CDDL), v1.0; or
005: * - the GNU Lesser General Public License, v2.1 or later
006: */
007: package javax.servlet.http;
008:
009: import java.util.Enumeration;
010: import java.security.Principal;
011:
012: /**
013: * Wraps HttpServletRequest objects in a decorator pattern
014: *
015: * @author <a href="mailto:rick_knowles@hotmail.com">Rick Knowles</a>
016: */
017: public class HttpServletRequestWrapper extends
018: javax.servlet.ServletRequestWrapper implements
019: HttpServletRequest {
020: private HttpServletRequest httpRequest;
021:
022: public HttpServletRequestWrapper(HttpServletRequest request) {
023: super (request);
024: this .httpRequest = request;
025: }
026:
027: public void setRequest(javax.servlet.ServletRequest request) {
028: if (request instanceof HttpServletRequest) {
029: super .setRequest(request);
030: this .httpRequest = (HttpServletRequest) request;
031: } else
032: throw new IllegalArgumentException(
033: "Not an HttpServletRequest");
034: }
035:
036: public String getAuthType() {
037: return this .httpRequest.getAuthType();
038: }
039:
040: public String getContextPath() {
041: return this .httpRequest.getContextPath();
042: }
043:
044: public Cookie[] getCookies() {
045: return this .httpRequest.getCookies();
046: }
047:
048: public long getDateHeader(String name) {
049: return this .httpRequest.getDateHeader(name);
050: }
051:
052: public String getHeader(String name) {
053: return this .httpRequest.getHeader(name);
054: }
055:
056: public Enumeration getHeaderNames() {
057: return this .httpRequest.getHeaderNames();
058: }
059:
060: public Enumeration getHeaders(String name) {
061: return this .httpRequest.getHeaders(name);
062: }
063:
064: public int getIntHeader(String name) {
065: return this .httpRequest.getIntHeader(name);
066: }
067:
068: public String getMethod() {
069: return this .httpRequest.getMethod();
070: }
071:
072: public String getPathInfo() {
073: return this .httpRequest.getPathInfo();
074: }
075:
076: public String getPathTranslated() {
077: return this .httpRequest.getPathTranslated();
078: }
079:
080: public String getQueryString() {
081: return this .httpRequest.getQueryString();
082: }
083:
084: public String getRemoteUser() {
085: return this .httpRequest.getRemoteUser();
086: }
087:
088: public String getRequestedSessionId() {
089: return this .httpRequest.getRequestedSessionId();
090: }
091:
092: public String getRequestURI() {
093: return this .httpRequest.getRequestURI();
094: }
095:
096: public String getServletPath() {
097: return this .httpRequest.getServletPath();
098: }
099:
100: public StringBuffer getRequestURL() {
101: return this .httpRequest.getRequestURL();
102: }
103:
104: public HttpSession getSession() {
105: return this .httpRequest.getSession();
106: }
107:
108: public HttpSession getSession(boolean create) {
109: return this .httpRequest.getSession(create);
110: }
111:
112: public Principal getUserPrincipal() {
113: return this .httpRequest.getUserPrincipal();
114: }
115:
116: public boolean isRequestedSessionIdFromCookie() {
117: return this .httpRequest.isRequestedSessionIdFromCookie();
118: }
119:
120: public boolean isRequestedSessionIdFromURL() {
121: return this .httpRequest.isRequestedSessionIdFromURL();
122: }
123:
124: public boolean isRequestedSessionIdValid() {
125: return this .httpRequest.isRequestedSessionIdValid();
126: }
127:
128: public boolean isUserInRole(String role) {
129: return this .httpRequest.isUserInRole(role);
130: }
131:
132: /**
133: * @deprecated
134: */
135: public boolean isRequestedSessionIdFromUrl() {
136: return this.httpRequest.isRequestedSessionIdFromUrl();
137: }
138: }
|