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