KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > beehive > netui > pageflow > scoping > internal > ScopedServletConfig


1 /*
2  * Copyright 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  * $Header:$
17  */

18 package org.apache.beehive.netui.pageflow.scoping.internal;
19
20 import javax.servlet.ServletConfig JavaDoc;
21 import javax.servlet.ServletContext JavaDoc;
22 import java.util.Enumeration JavaDoc;
23
24
25 /**
26  * A wrapper around ServletConfig, associated with a given scope-key.
27  */

28 public class ScopedServletConfig
29         extends AttributeContainer
30         implements ServletConfig JavaDoc
31 {
32     private ServletContext JavaDoc _context;
33     private String JavaDoc _servletName;
34
35     public ScopedServletConfig( ServletContext JavaDoc context, ServletConfig JavaDoc baseServletConfig )
36     {
37         _context = context;
38
39         for ( Enumeration JavaDoc e = baseServletConfig.getInitParameterNames(); e.hasMoreElements(); )
40         {
41             String JavaDoc paramName = ( String JavaDoc ) e.nextElement();
42             setAttribute( paramName, baseServletConfig.getInitParameter( paramName ) );
43         }
44         
45         _servletName = baseServletConfig.getServletName();
46     }
47
48     public String JavaDoc getServletName()
49     {
50         return _servletName;
51     }
52
53     public ServletContext JavaDoc getServletContext()
54     {
55         return _context;
56     }
57
58     public String JavaDoc getInitParameter( String JavaDoc s )
59     {
60         return ( String JavaDoc ) getAttribute( s );
61     }
62
63     public Enumeration JavaDoc getInitParameterNames()
64     {
65         return getAttributeNames();
66     }
67 }
68
Popular Tags