⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pi3servletconfig.java

📁 mini http server,可以集成嵌入到程序中,实现简单的web功能
💻 JAVA
字号:
/*____________________________________________________________________________*\
 *

 Copyright (c) 1997-2003 John Roy, Holger Zimmermann. All rights reserved.

 These sources, libraries and applications are
 FREE FOR COMMERCIAL AND NON-COMMERCIAL USE
 as long as the following conditions are adhered to.

 Redistribution and use in source and binary forms, with or without
 modification, are permitted provided that the following conditions
 are met:

 1. Redistributions of source code must retain the above copyright
    notice, this list of conditions and the following disclaimer. 

 2. Redistributions in binary form must reproduce the above copyright
    notice, this list of conditions and the following disclaimer in
    the documentation and/or other materials provided with the
    distribution.

 3. The name of the author may not be used to endorse or promote products
    derived from this software without specific prior written permission. 

 THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
 WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
 IN NO EVENT SHALL THE AUTHORS OR ITS CONTRIBUTORS BE LIABLE FOR ANY
 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
 GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
 STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
 OF THE POSSIBILITY OF SUCH DAMAGE.

 *____________________________________________________________________________*|
 *
 * $Source: /cvsroot/pi3web/Pi3Web_200/Source/Servlet/org/pi3/servlet/core/Pi3ServletConfig.java,v $
 * $Date: 2003/05/13 18:42:21 $
 *
 Description:
	Implementation of servlet API ServletConfig interface.

\*____________________________________________________________________________*/

package org.pi3.servlet.core;

import java.util.Enumeration;
import java.util.Hashtable;
import javax.servlet.ServletContext;
import javax.servlet.ServletConfig;


/**
 * 
 * A servlet configuration object used by a servlet container
 * used to pass information to a servlet during initialization. 
 *
 * <p>The configuration information contains initialization parameters,
 * which are a set of name/value pairs, and a {@link ServletContext} object,
 * which gives the servlet information about the server.
 *
 * @author 	Holger Zimmermann [zimpel@pi3.org]
 * @version	$Revision: 1.6 $
 *
 * @see 	Pi3ServletContext
 *
 */

final public class Pi3ServletConfig implements ServletConfig {
	private Pi3ServletContext con;
	private Hashtable params = new Hashtable();
	private String sname;




	/** This constructor is used by the native side */
	protected Pi3ServletConfig(Pi3ServletContext context) {
		con = context;
		sname = "";
	}




	/** This constructor is used by the native side */
	protected Pi3ServletConfig(Pi3ServletContext context, String servletname) {
		con = context;
		sname = servletname;
	}




    /**
     * Returns a reference to the {@link Pi3ServletContext} in which the servlet
     * is executing.
     *
     *
     * @return		a {@link Pi3ServletContext} object, used
     *			by the servlet to interact with its servlet container
     * 
     * @see		Pi3ServletContext
     *
     */

	public ServletContext getServletContext() {
		return (ServletContext)con;
	}
    
    
    

    /**
     * Returns a <code>String</code> containing the value of the 
     * named initialization parameter, or <code>null</code> if 
     * the parameter does not exist.
     *
     * @param name	a <code>String</code> specifying the name
     *			of the initialization parameter
     *
     * @return		a <code>String</code> containing the value 
     *			of the initialization parameter
     *
     */

	public String getInitParameter(String name) {
		return (String)params.get(name);		
	}

    
    

    /**
     * Returns the names of the servlet's initialization parameters
     * as an <code>Enumeration</code> of <code>String</code> objects, 
     * or an empty <code>Enumeration</code> if the servlet has
     * no initialization parameters.
     *
     * @return		an <code>Enumeration</code> of <code>String</code> 
     *			objects containing the names of the servlet's 
     *			initialization parameters
     *
     *
     *
     */

	public Enumeration getInitParameterNames() {
		return params.keys();
	}

    
    

    /**
     * Sets the value of a servlet initialization parameter as an
     * <code>Object</code> referenced by its name as <code>String</code>.
     *
     * @param name	an <code>String</code> with the name of the 
     *			initialization parameter to set
     * @param object	an <code>Object</code> presenting the 
     *			initialization parameter
     *
     *
     *
     */

	public void setInitParameter(String name, Object object) {
		params.put(name, object);
	}




    /**
     * Removes the servlet initialization parameter given by its name as
     * <code>String</code>.
     *
     * @param name	an <code>String</code> with the name of the 
     *			initialization parameter to remove
     *
     *
     *
     */

	public void removeInitParameter(String name) {
		params.remove(name);
	}




    /**
     * Returns the name of this servlet instance.
     * The name may be provided via server administration, assigned in the 
     * web application deployment descriptor, or for an unregistered (and thus
     * unnamed) servlet instance it will be the servlet's class name.
     *
     * @return		the name of the servlet instance
     *
     *
     *
     */

	public String getServletName() { return sname; };


	static {
		System.loadLibrary("Pi3ServletJNI");
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -