home *** CD-ROM | disk | FTP | other *** search
/ Java Developer's Companion / Java Developer's Companion.iso / binaries / Windows / jsdk / src / javax / servlet / ServletConfig.java < prev    next >
Encoding:
Java Source  |  1997-07-18  |  2.6 KB  |  77 lines

  1. /*
  2.  * @(#)ServletConfig.java    1.14 97/05/22
  3.  * 
  4.  * Copyright (c) 1995-1997 Sun Microsystems, Inc. All Rights Reserved.
  5.  * 
  6.  * This software is the confidential and proprietary information of Sun
  7.  * Microsystems, Inc. ("Confidential Information").  You shall not
  8.  * disclose such Confidential Information and shall use it only in
  9.  * accordance with the terms of the license agreement you entered into
  10.  * with Sun.
  11.  * 
  12.  * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE
  13.  * SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  14.  * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
  15.  * PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR ANY DAMAGES
  16.  * SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING
  17.  * THIS SOFTWARE OR ITS DERIVATIVES.
  18.  * 
  19.  * CopyrightVersion 1.0
  20.  */
  21.  
  22. package javax.servlet;
  23.  
  24. import java.util.Enumeration;
  25.  
  26. /**
  27.  * This interface is implemented by services in order to pass
  28.  * configuration information to a servlet when it is first loaded.  A
  29.  * service writer implementing this interface must write methods for the
  30.  * servlet to use to get its initialization parameters and the context
  31.  * in which it is running. 
  32.  *
  33.  * <p>The ServletConfig interface can also be implemented by servlets.
  34.  * (GenericServlet does this.)  When implemented by a servlet, the
  35.  * methods in the interface make getting the configuration data more
  36.  * convenient.  For example, a servlet could implement
  37.  * getServletContext by writing,
  38.  * 
  39.  * <pre>
  40.  *   public ServletContext getServletContext() {
  41.  *    return getServletConfig().getServletContext();
  42.  *   }
  43.  * </pre>
  44.  * making access to the servlet's context object a single method
  45.  * invocation (a call to <code>getServletContext()</code>).
  46.  *
  47.  * @version     1.14, 05/22/97
  48.  * @author David Connelly
  49.  */
  50.  
  51. public
  52. interface ServletConfig {
  53.     /**
  54.      * Returns the context for the servlet.
  55.      */
  56.     public ServletContext getServletContext();
  57.  
  58.     /**
  59.      *
  60.      * Returns a string containing the value of the named
  61.      * initialization parameter of the servlet, or null if the
  62.      * parameter does not exist.  Init parameters have a single string
  63.      * value; it is the responsibility of the servlet writer to
  64.      * interpret the string.
  65.      *
  66.      * @param name the name of the parameter whose value is requested
  67.      */
  68.     public String getInitParameter(String name);
  69.  
  70.     /**
  71.      * Returns the names of the servlet's initialization parameters
  72.      * as an enumeration of strings, or an empty enumeration if there
  73.      * are no initialization parameters.
  74.      */
  75.     public Enumeration getInitParameterNames();
  76. }
  77.