01: /*
02: * Copyright 2007 Google Inc.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License"); you may not
05: * use this file except in compliance with the License. You may obtain a copy of
06: * the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12: * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13: * License for the specific language governing permissions and limitations under
14: * the License.
15: */
16: package com.google.gwt.dev.shell;
17:
18: import java.util.Enumeration;
19:
20: import javax.servlet.ServletConfig;
21: import javax.servlet.ServletContext;
22:
23: /**
24: * {@link ServletConfig} proxy which ensures that an un-proxied
25: * {@link ServletContext} is never returned to a servlet in hosted mode.
26: */
27: class HostedModeServletConfigProxy implements ServletConfig {
28: private final ServletConfig config;
29: private final ServletContext context;
30:
31: public HostedModeServletConfigProxy(ServletConfig config,
32: ServletContext context) {
33: this .config = config;
34: this .context = context;
35: }
36:
37: /**
38: * @param arg0
39: * @return
40: * @see javax.servlet.ServletConfig#getInitParameter(java.lang.String)
41: */
42: public String getInitParameter(String arg0) {
43: return config.getInitParameter(arg0);
44: }
45:
46: /**
47: * @return
48: * @see javax.servlet.ServletConfig#getInitParameterNames()
49: */
50: public Enumeration<String> getInitParameterNames() {
51: return config.getInitParameterNames();
52: }
53:
54: /**
55: * @return
56: * @see javax.servlet.ServletConfig#getServletContext()
57: */
58: public ServletContext getServletContext() {
59: return context;
60: }
61:
62: /**
63: * @return
64: * @see javax.servlet.ServletConfig#getServletName()
65: */
66: public String getServletName() {
67: return config.getServletName();
68: }
69: }
|