001 /**
002 *
003 * Copyright 2003-2004 The Apache Software Foundation
004 *
005 * Licensed under the Apache License, Version 2.0 (the "License");
006 * you may not use this file except in compliance with the License.
007 * You may obtain a copy of the License at
008 *
009 * http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017
018 //
019 // This source code implements specifications defined by the Java
020 // Community Process. In order to remain compliant with the specification
021 // DO NOT add / change / or delete method signatures!
022 //
023
024 package javax.servlet;
025
026 import java.util.Enumeration;
027
028 /**
029 * A servlet configuration object used by a servlet container
030 * to pass information to a servlet during initialization.
031 *
032 * @version $Rev: 46019 $ $Date: 2004-09-14 02:56:06 -0700 (Tue, 14 Sep 2004) $
033 */
034 public interface ServletConfig {
035 /**
036 * Returns the name of this servlet instance.
037 * The name may be provided via server administration, assigned in the
038 * web application deployment descriptor, or for an unregistered (and thus
039 * unnamed) servlet instance it will be the servlet's class name.
040 *
041 * @return the name of the servlet instance
042 */
043 public String getServletName();
044
045 /**
046 * Returns a reference to the {@link ServletContext} in which the caller
047 * is executing.
048 * @return a {@link ServletContext} object, used
049 * by the caller to interact with its servlet container
050 *
051 * @see ServletContext
052 */
053 public ServletContext getServletContext();
054
055 /**
056 * Returns a <code>String</code> containing the value of the
057 * named initialization parameter, or <code>null</code> if
058 * the parameter does not exist.
059 *
060 * @param name a <code>String</code> specifying the name
061 * of the initialization parameter
062 *
063 * @return a <code>String</code> containing the value
064 * of the initialization parameter
065 */
066 public String getInitParameter(String name);
067
068 /**
069 * Returns the names of the servlet's initialization parameters
070 * as an <code>Enumeration</code> of <code>String</code> objects,
071 * or an empty <code>Enumeration</code> if the servlet has
072 * no initialization parameters.
073 *
074 * @return an <code>Enumeration</code> of <code>String</code>
075 * objects containing the names of the servlet's initialization parameters
076 */
077 public Enumeration getInitParameterNames();
078 }