View Javadoc

1   /**
2    *
3    * Copyright 2003-2004 The Apache Software Foundation
4    *
5    *  Licensed under the Apache License, Version 2.0 (the "License");
6    *  you may not use this file except in compliance with the License.
7    *  You may obtain a copy of the License at
8    *
9    *     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  //
19  // This source code implements specifications defined by the Java
20  // Community Process. In order to remain compliant with the specification
21  // DO NOT add / change / or delete method signatures!
22  //
23  
24  package javax.servlet;
25  
26  import java.util.Enumeration;
27  
28  /**
29   * A servlet configuration object used by a servlet container
30   * to pass information to a servlet during initialization.
31   *
32   * @version $Rev: 46019 $ $Date: 2004-09-14 02:56:06 -0700 (Tue, 14 Sep 2004) $
33   */
34  public interface ServletConfig {
35      /**
36       * Returns the name of this servlet instance.
37       * The name may be provided via server administration, assigned in the
38       * web application deployment descriptor, or for an unregistered (and thus
39       * unnamed) servlet instance it will be the servlet's class name.
40       *
41       * @return the name of the servlet instance
42       */
43      public String getServletName();
44  
45      /**
46       * Returns a reference to the {@link ServletContext} in which the caller
47       * is executing.
48       * @return a {@link ServletContext} object, used
49       * by the caller to interact with its servlet container
50       *
51       * @see ServletContext
52       */
53      public ServletContext getServletContext();
54  
55      /**
56       * Returns a <code>String</code> containing the value of the
57       * named initialization parameter, or <code>null</code> if
58       * the parameter does not exist.
59       *
60       * @param name a <code>String</code> specifying the name
61       * of the initialization parameter
62       *
63       * @return a <code>String</code> containing the value
64       * of the initialization parameter
65       */
66      public String getInitParameter(String name);
67  
68      /**
69       * Returns the names of the servlet's initialization parameters
70       * as an <code>Enumeration</code> of <code>String</code> objects,
71       * or an empty <code>Enumeration</code> if the servlet has
72       * no initialization parameters.
73       *
74       * @return an <code>Enumeration</code> of <code>String</code>
75       * objects containing the names of the servlet's initialization parameters
76       */
77      public Enumeration getInitParameterNames();
78  }