1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one or more 3 * contributor license agreements. See the NOTICE file distributed with 4 * this work for additional information regarding copyright ownership. 5 * The ASF licenses this file to You under the Apache License, Version 2.0 6 * (the "License"); you may not use this file except in compliance with 7 * the License. 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 package javax.servlet; 18 19 import java.util.Enumeration; 20 21 22 23 /** 24 * 25 * A servlet configuration object used by a servlet container 26 * to pass information to a servlet during initialization. 27 * 28 */ 29 30 public interface ServletConfig { 31 32 33 /** 34 * Returns the name of this servlet instance. 35 * The name may be provided via server administration, assigned in the 36 * web application deployment descriptor, or for an unregistered (and thus 37 * unnamed) servlet instance it will be the servlet's class name. 38 * 39 * @return the name of the servlet instance 40 * 41 * 42 * 43 */ 44 45 public String getServletName(); 46 47 /** 48 * Returns a reference to the {@link ServletContext} in which the caller 49 * is executing. 50 * 51 * 52 * @return a {@link ServletContext} object, used 53 * by the caller to interact with its servlet 54 * container 55 * 56 * @see ServletContext 57 * 58 */ 59 60 public ServletContext getServletContext(); 61 62 /** 63 * Returns a <code>String</code> containing the value of the 64 * named initialization parameter, or <code>null</code> if 65 * the parameter does not exist. 66 * 67 * @param name a <code>String</code> specifying the name 68 * of the initialization parameter 69 * 70 * @return a <code>String</code> containing the value 71 * of the initialization parameter 72 * 73 */ 74 75 public String getInitParameter(String name); 76 77 78 /** 79 * Returns the names of the servlet's initialization parameters 80 * as an <code>Enumeration</code> of <code>String</code> objects, 81 * or an empty <code>Enumeration</code> if the servlet has 82 * no initialization parameters. 83 * 84 * @return an <code>Enumeration</code> of <code>String</code> 85 * objects containing the names of the servlet's 86 * initialization parameters 87 * 88 * 89 * 90 */ 91 92 public Enumeration getInitParameterNames(); 93 94 95 } 96