KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > go > teaservlet > util > FilteredServletContext


1 /* ====================================================================
2  * TeaServlet - Copyright (c) 1999-2000 Walt Disney Internet Group
3  * ====================================================================
4  * The Tea Software License, Version 1.1
5  *
6  * Copyright (c) 2000 Walt Disney Internet Group. All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  *
12  * 1. Redistributions of source code must retain the above copyright
13  * notice, this list of conditions and the following disclaimer.
14  *
15  * 2. Redistributions in binary form must reproduce the above copyright
16  * notice, this list of conditions and the following disclaimer in
17  * the documentation and/or other materials provided with the
18  * distribution.
19  *
20  * 3. The end-user documentation included with the redistribution,
21  * if any, must include the following acknowledgment:
22  * "This product includes software developed by the
23  * Walt Disney Internet Group (http://opensource.go.com/)."
24  * Alternately, this acknowledgment may appear in the software itself,
25  * if and wherever such third-party acknowledgments normally appear.
26  *
27  * 4. The names "Tea", "TeaServlet", "Kettle", "Trove" and "BeanDoc" must
28  * not be used to endorse or promote products derived from this
29  * software without prior written permission. For written
30  * permission, please contact opensource@dig.com.
31  *
32  * 5. Products derived from this software may not be called "Tea",
33  * "TeaServlet", "Kettle" or "Trove", nor may "Tea", "TeaServlet",
34  * "Kettle", "Trove" or "BeanDoc" appear in their name, without prior
35  * written permission of the Walt Disney Internet Group.
36  *
37  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
38  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
39  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
40  * DISCLAIMED. IN NO EVENT SHALL THE WALT DISNEY INTERNET GROUP OR ITS
41  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
42  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
43  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
44  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
45  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
46  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
47  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
48  * ====================================================================
49  *
50  * For more information about Tea, please see http://opensource.go.com/.
51  */

52
53 package com.go.teaservlet.util;
54
55 import java.util.Enumeration JavaDoc;
56 import java.util.Set JavaDoc;
57 import java.net.URL JavaDoc;
58 import java.net.MalformedURLException JavaDoc;
59 import java.io.InputStream JavaDoc;
60 import javax.servlet.Servlet JavaDoc;
61 import javax.servlet.ServletException JavaDoc;
62 import javax.servlet.ServletContext JavaDoc;
63 import javax.servlet.RequestDispatcher JavaDoc;
64
65 /******************************************************************************
66  * A ServletContext wrapper that passes all calls to an internal
67  * ServletContext. This class is designed for subclasses to override or
68  * hook into the behavior of a ServletContext instance.
69  *
70  * @author Brian S O'Neill
71  * @version
72  * <!--$$Revision:--> 8 <!-- $-->, <!--$$JustDate:--> 01/03/20 <!-- $-->
73  */

74 public class FilteredServletContext implements ServletContext JavaDoc {
75     protected final ServletContext JavaDoc mContext;
76
77     public FilteredServletContext(ServletContext JavaDoc context) {
78         mContext = context;
79     }
80
81     public void log(String JavaDoc message) {
82         mContext.log(message);
83     }
84
85     public void log(String JavaDoc message, Throwable JavaDoc t) {
86         mContext.log(message, t);
87     }
88
89     public String JavaDoc getRealPath(String JavaDoc path) {
90         return mContext.getRealPath(path);
91     }
92
93     public String JavaDoc getMimeType(String JavaDoc file) {
94         return mContext.getMimeType(file);
95     }
96
97     public String JavaDoc getServerInfo() {
98         return mContext.getServerInfo();
99     }
100
101     public Object JavaDoc getAttribute(String JavaDoc name) {
102         return mContext.getAttribute(name);
103     }
104
105     public void setAttribute(String JavaDoc name, Object JavaDoc value) {
106         mContext.setAttribute(name, value);
107     }
108
109     public void removeAttribute(String JavaDoc name) {
110         mContext.removeAttribute(name);
111     }
112
113     public Enumeration JavaDoc getAttributeNames() {
114         return mContext.getAttributeNames();
115     }
116
117     public ServletContext JavaDoc getContext(String JavaDoc uripath) {
118         return mContext.getContext(uripath);
119     }
120
121     public RequestDispatcher JavaDoc getRequestDispatcher(String JavaDoc uripath) {
122         return mContext.getRequestDispatcher(uripath);
123     }
124
125     public int getMajorVersion() {
126         return mContext.getMajorVersion();
127     }
128
129     public int getMinorVersion() {
130         return mContext.getMinorVersion();
131     }
132
133     public Set JavaDoc getResourcePaths() {
134         return mContext.getResourcePaths();
135     }
136
137     public URL JavaDoc getResource(String JavaDoc uripath) throws MalformedURLException JavaDoc {
138         return mContext.getResource(uripath);
139     }
140
141     public InputStream JavaDoc getResourceAsStream(String JavaDoc uripath) {
142         return mContext.getResourceAsStream(uripath);
143     }
144
145     public RequestDispatcher JavaDoc getNamedDispatcher(String JavaDoc name) {
146         return mContext.getNamedDispatcher(name);
147     }
148
149     public Enumeration JavaDoc getInitParameterNames() {
150         return mContext.getInitParameterNames();
151     }
152
153     public String JavaDoc getInitParameter(String JavaDoc name) {
154         return mContext.getInitParameter(name);
155     }
156
157     public String JavaDoc getServletContextName() {
158         return mContext.getServletContextName();
159     }
160
161     /**
162      * @deprecated
163      */

164     public void log(Exception JavaDoc e, String JavaDoc message) {
165         log(message, e);
166     }
167
168     /**
169      * @deprecated
170      */

171     public Servlet JavaDoc getServlet(String JavaDoc name) throws ServletException JavaDoc {
172         return mContext.getServlet(name);
173     }
174
175     /**
176      * @deprecated
177      */

178     public Enumeration JavaDoc getServlets() {
179         return mContext.getServlets();
180     }
181
182     /**
183      * @deprecated
184      */

185     public Enumeration JavaDoc getServletNames() {
186         return mContext.getServletNames();
187     }
188 }
189
Popular Tags