01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17:
18: package org.apache.catalina.core;
19:
20: import java.util.Enumeration;
21:
22: import javax.servlet.ServletConfig;
23: import javax.servlet.ServletContext;
24:
25: /**
26: * Facade for the <b>StandardWrapper</b> object.
27: *
28: * @author Remy Maucharat
29: * @version $Revision: 505618 $ $Date: 2007-02-10 03:30:04 +0100 (sam., 10 févr. 2007) $
30: */
31:
32: public final class StandardWrapperFacade implements ServletConfig {
33:
34: // ----------------------------------------------------------- Constructors
35:
36: /**
37: * Create a new facede around a StandardWrapper.
38: */
39: public StandardWrapperFacade(StandardWrapper config) {
40:
41: super ();
42: this .config = (ServletConfig) config;
43:
44: }
45:
46: // ----------------------------------------------------- Instance Variables
47:
48: /**
49: * Wrapped config.
50: */
51: private ServletConfig config = null;
52:
53: /**
54: * Wrapped context (facade).
55: */
56: private ServletContext context = null;
57:
58: // -------------------------------------------------- ServletConfig Methods
59:
60: public String getServletName() {
61: return config.getServletName();
62: }
63:
64: public ServletContext getServletContext() {
65: if (context == null) {
66: context = config.getServletContext();
67: if ((context != null)
68: && (context instanceof ApplicationContext))
69: context = ((ApplicationContext) context).getFacade();
70: }
71: return (context);
72: }
73:
74: public String getInitParameter(String name) {
75: return config.getInitParameter(name);
76: }
77:
78: public Enumeration getInitParameterNames() {
79: return config.getInitParameterNames();
80: }
81:
82: }
|