KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > cocoon > components > jsp > JSPEngineServletRequest


1 /*
2  * Copyright 1999-2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package org.apache.cocoon.components.jsp;
17
18 import java.io.BufferedReader JavaDoc;
19 import java.io.IOException JavaDoc;
20 import java.security.Principal JavaDoc;
21 import java.util.Enumeration JavaDoc;
22 import java.util.Locale JavaDoc;
23
24 import javax.servlet.RequestDispatcher JavaDoc;
25 import javax.servlet.ServletInputStream JavaDoc;
26 import javax.servlet.http.Cookie JavaDoc;
27 import javax.servlet.http.HttpServletRequest JavaDoc;
28 import javax.servlet.http.HttpSession JavaDoc;
29
30 /**
31  * Stub implementation of HttpServletRequest.
32  */

33 public class JSPEngineServletRequest implements HttpServletRequest JavaDoc {
34
35     /** The servlet include path. */
36     private static final String JavaDoc INC_SERVLET_PATH = "javax.servlet.include.servlet_path";
37     /** The servlet request uri, needed for Resin. */
38     private static final String JavaDoc INC_REQUEST_URI = "javax.servlet.include.request_uri";
39     
40     private final HttpServletRequest JavaDoc request;
41     private final String JavaDoc jspFile;
42
43     public JSPEngineServletRequest(HttpServletRequest JavaDoc request, String JavaDoc jspFile) {
44         this.request = request;
45         this.jspFile = jspFile;
46     }
47     public String JavaDoc getAuthType(){ return request.getAuthType(); }
48     public Cookie JavaDoc[] getCookies(){ return request.getCookies(); }
49     public long getDateHeader(String JavaDoc s){ return request.getDateHeader(s); }
50     public String JavaDoc getHeader(String JavaDoc s){ return request.getHeader(s); }
51     public Enumeration JavaDoc getHeaders(String JavaDoc s){ return request.getHeaders(s); }
52     public Enumeration JavaDoc getHeaderNames(){ return request.getHeaderNames(); }
53     public int getIntHeader(String JavaDoc s){ return request.getIntHeader(s); }
54     public String JavaDoc getMethod(){ return request.getMethod(); }
55     public String JavaDoc getPathInfo(){ return request.getPathInfo(); }
56     public String JavaDoc getPathTranslated(){ return request.getPathTranslated(); }
57     public String JavaDoc getContextPath(){ return request.getContextPath(); }
58     public String JavaDoc getQueryString(){ return request.getQueryString(); }
59     public String JavaDoc getRemoteUser(){ return request.getRemoteUser(); }
60     public boolean isUserInRole(String JavaDoc s){ return request.isUserInRole(s); }
61     public Principal JavaDoc getUserPrincipal(){ return request.getUserPrincipal(); }
62     public String JavaDoc getRequestedSessionId(){ return request.getRequestedSessionId(); }
63     public String JavaDoc getRequestURI(){ return request.getRequestURI(); }
64     public String JavaDoc getServletPath(){ return request.getServletPath(); }
65     public HttpSession JavaDoc getSession(boolean flag){ return request.getSession(flag); }
66     public HttpSession JavaDoc getSession(){ return request.getSession(); }
67     public boolean isRequestedSessionIdValid(){ return request.isRequestedSessionIdValid(); }
68     public boolean isRequestedSessionIdFromCookie(){ return request.isRequestedSessionIdFromCookie(); }
69     public boolean isRequestedSessionIdFromURL(){ return request.isRequestedSessionIdFromURL(); }
70     /** @deprecated use isRequestedSessionIdFromURL instead. */
71     public boolean isRequestedSessionIdFromUrl(){ return request.isRequestedSessionIdFromUrl(); }
72     public Object JavaDoc getAttribute(String JavaDoc s){
73         if (s != null && (s.equals(INC_SERVLET_PATH) || s.equals(INC_REQUEST_URI))) {
74             return jspFile;
75         }
76         return request.getAttribute(s);
77     }
78     public Enumeration JavaDoc getAttributeNames(){ return request.getAttributeNames(); }
79     public String JavaDoc getCharacterEncoding(){ return request.getCharacterEncoding(); }
80     public int getContentLength(){ return request.getContentLength(); }
81     public String JavaDoc getContentType(){ return request.getContentType(); }
82     public ServletInputStream JavaDoc getInputStream() throws IOException JavaDoc{ return request.getInputStream(); }
83     public String JavaDoc getParameter(String JavaDoc s){ return request.getParameter(s); }
84     public Enumeration JavaDoc getParameterNames(){ return request.getParameterNames(); }
85     public String JavaDoc[] getParameterValues(String JavaDoc s){ return request.getParameterValues(s); }
86     public String JavaDoc getProtocol(){ return request.getProtocol(); }
87     public String JavaDoc getScheme(){ return request.getScheme(); }
88     public String JavaDoc getServerName(){ return request.getServerName(); }
89     public int getServerPort(){ return request.getServerPort(); }
90     public BufferedReader JavaDoc getReader()
91         throws IOException JavaDoc{ return request.getReader(); }
92     public String JavaDoc getRemoteAddr(){ return request.getRemoteAddr(); }
93     public String JavaDoc getRemoteHost(){ return request.getRemoteHost(); }
94     public void setAttribute(String JavaDoc s, Object JavaDoc obj){ request.setAttribute(s,obj); }
95     public void removeAttribute(String JavaDoc s){ request.removeAttribute(s); }
96     public Locale JavaDoc getLocale(){ return request.getLocale(); }
97     public Enumeration JavaDoc getLocales(){ return request.getLocales(); }
98     public boolean isSecure(){ return request.isSecure(); }
99     public RequestDispatcher JavaDoc getRequestDispatcher(String JavaDoc s){ return request.getRequestDispatcher(s); }
100     /** @deprecated use ServletContext.getRealPath(java.lang.String) instead. */
101     public String JavaDoc getRealPath(String JavaDoc s){ return request.getRealPath(s); }
102     public java.lang.StringBuffer JavaDoc getRequestURL() { return null; }
103     public java.util.Map JavaDoc getParameterMap() { return null; }
104     public void setCharacterEncoding(java.lang.String JavaDoc s) { }
105 }
106
Popular Tags