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