001: /*
002: * Copyright 1999,2004 The Apache Software Foundation.
003: *
004: * Licensed under the Apache License, Version 2.0 (the "License");
005: * you may not use this file except in compliance with the License.
006: * You may obtain a copy of the License at
007: *
008: * http://www.apache.org/licenses/LICENSE-2.0
009: *
010: * Unless required by applicable law or agreed to in writing, software
011: * distributed under the License is distributed on an "AS IS" BASIS,
012: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013: * See the License for the specific language governing permissions and
014: * limitations under the License.
015: */
016:
017: package org.apache.catalina.connector;
018:
019: import java.util.Enumeration;
020:
021: import javax.servlet.http.Cookie;
022: import javax.servlet.http.HttpServletRequest;
023: import javax.servlet.http.HttpSession;
024:
025: import org.apache.catalina.HttpRequest;
026: import org.apache.catalina.session.StandardSessionFacade;
027:
028: /**
029: * Facade class that wraps a Catalina-internal <b>HttpRequest</b>
030: * object. All methods are delegated to the wrapped request.
031: *
032: * @author Remy Maucherat
033: * @version $Revision: 1.3 $ $Date: 2004/02/27 14:58:41 $
034: */
035:
036: public final class HttpRequestFacade extends RequestFacade implements
037: HttpServletRequest {
038:
039: // ----------------------------------------------------------- Constructors
040:
041: /**
042: * Construct a wrapper for the specified request.
043: *
044: * @param request The request to be wrapped
045: */
046: public HttpRequestFacade(HttpRequest request) {
047: super (request);
048: }
049:
050: // --------------------------------------------- HttpServletRequest Methods
051:
052: public String getAuthType() {
053: return ((HttpServletRequest) request).getAuthType();
054: }
055:
056: public Cookie[] getCookies() {
057: return ((HttpServletRequest) request).getCookies();
058: }
059:
060: public long getDateHeader(String name) {
061: return ((HttpServletRequest) request).getDateHeader(name);
062: }
063:
064: public String getHeader(String name) {
065: return ((HttpServletRequest) request).getHeader(name);
066: }
067:
068: public Enumeration getHeaders(String name) {
069: return ((HttpServletRequest) request).getHeaders(name);
070: }
071:
072: public Enumeration getHeaderNames() {
073: return ((HttpServletRequest) request).getHeaderNames();
074: }
075:
076: public int getIntHeader(String name) {
077: return ((HttpServletRequest) request).getIntHeader(name);
078: }
079:
080: public String getMethod() {
081: return ((HttpServletRequest) request).getMethod();
082: }
083:
084: public String getPathInfo() {
085: return ((HttpServletRequest) request).getPathInfo();
086: }
087:
088: public String getPathTranslated() {
089: return ((HttpServletRequest) request).getPathTranslated();
090: }
091:
092: public String getContextPath() {
093: return ((HttpServletRequest) request).getContextPath();
094: }
095:
096: public String getQueryString() {
097: return ((HttpServletRequest) request).getQueryString();
098: }
099:
100: public String getRemoteUser() {
101: return ((HttpServletRequest) request).getRemoteUser();
102: }
103:
104: public boolean isUserInRole(String role) {
105: return ((HttpServletRequest) request).isUserInRole(role);
106: }
107:
108: public java.security.Principal getUserPrincipal() {
109: return ((HttpServletRequest) request).getUserPrincipal();
110: }
111:
112: public String getRequestedSessionId() {
113: return ((HttpServletRequest) request).getRequestedSessionId();
114: }
115:
116: public String getRequestURI() {
117: return ((HttpServletRequest) request).getRequestURI();
118: }
119:
120: public StringBuffer getRequestURL() {
121: return ((HttpServletRequest) request).getRequestURL();
122: }
123:
124: public String getServletPath() {
125: return ((HttpServletRequest) request).getServletPath();
126: }
127:
128: public HttpSession getSession(boolean create) {
129: HttpSession session = ((HttpServletRequest) request)
130: .getSession(create);
131: if (session == null)
132: return null;
133: else
134: return new StandardSessionFacade(session);
135: }
136:
137: public HttpSession getSession() {
138: return getSession(true);
139: }
140:
141: public boolean isRequestedSessionIdValid() {
142: return ((HttpServletRequest) request)
143: .isRequestedSessionIdValid();
144: }
145:
146: public boolean isRequestedSessionIdFromCookie() {
147: return ((HttpServletRequest) request)
148: .isRequestedSessionIdFromCookie();
149: }
150:
151: public boolean isRequestedSessionIdFromURL() {
152: return ((HttpServletRequest) request)
153: .isRequestedSessionIdFromURL();
154: }
155:
156: public boolean isRequestedSessionIdFromUrl() {
157: return ((HttpServletRequest) request)
158: .isRequestedSessionIdFromURL();
159: }
160:
161: }
|