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     * A servlet configuration object used by a servlet container
027     * to pass information to a servlet during initialization. 
028     *
029     * @version $Rev: 788194 $ $Date: 2009-06-24 18:05:48 -0400 (Wed, 24 Jun 2009) $
030     */
031     
032    public interface ServletConfig {
033    
034        /**
035         * Returns the name of this servlet instance.
036         * The name may be provided via server administration, assigned in the 
037         * web application deployment descriptor, or for an unregistered (and thus
038         * unnamed) servlet instance it will be the servlet's class name.
039         *
040         * @return          the name of the servlet instance
041         */
042        public String getServletName();
043    
044        /**
045         * Returns a reference to the {@link ServletContext} in which the caller
046         * is executing.
047         *
048         * @return          a {@link ServletContext} object, used
049         *                  by the caller to interact with its servlet 
050         *                  container
051         * 
052         * @see             ServletContext
053         */
054        public ServletContext getServletContext();
055        
056        /**
057         * Returns a <code>String</code> containing the value of the 
058         * named initialization parameter, or <code>null</code> if 
059         * the parameter does not exist.
060         *
061         * @param name      a <code>String</code> specifying the name
062         *                  of the initialization parameter
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 
076         *                  initialization parameters
077         */
078        public Enumeration<String> getInitParameterNames();
079    
080    }