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