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

📄 ajp13connector.java

📁 Tomcat 4.1与WebServer集成组件的源代码包.
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
/* * $Header: /home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/ajp/tomcat4/Ajp13Connector.java,v 1.17 2002/12/27 02:21:27 glenn Exp $ * $Revision: 1.17 $ * $Date: 2002/12/27 02:21:27 $ * * ==================================================================== * * The Apache Software License, Version 1.1 * * Copyright (c) 1999 The Apache Software Foundation.  All rights * reserved. * * 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 end-user documentation included with the redistribution, if *    any, must include the following acknowlegement: *       "This product includes software developed by the *        Apache Software Foundation (http://www.apache.org/)." *    Alternately, this acknowlegement may appear in the software itself, *    if and wherever such third-party acknowlegements normally appear. * * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software *    Foundation" must not be used to endorse or promote products derived *    from this software without prior written permission. For written *    permission, please contact apache@apache.org. * * 5. Products derived from this software may not be called "Apache" *    nor may "Apache" appear in their names without prior written *    permission of the Apache Group. * * 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 APACHE SOFTWARE FOUNDATION 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. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation.  For more * information on the Apache Software Foundation, please see * <http://www.apache.org/>. * * [Additional notices, if required by prior licensing conditions] * */package org.apache.ajp.tomcat4;import java.io.IOException;import java.net.InetAddress;import java.net.ServerSocket;import java.net.Socket;import java.security.AccessControlException;import java.util.Stack;import java.util.Vector;import java.util.Enumeration;import org.apache.catalina.Connector;import org.apache.catalina.Container;import org.apache.catalina.HttpRequest;import org.apache.catalina.HttpResponse;import org.apache.catalina.Lifecycle;import org.apache.catalina.LifecycleEvent;import org.apache.catalina.LifecycleException;import org.apache.catalina.LifecycleListener;import org.apache.catalina.Logger;import org.apache.catalina.Request;import org.apache.catalina.Response;import org.apache.catalina.Service;import org.apache.catalina.net.DefaultServerSocketFactory;import org.apache.catalina.net.ServerSocketFactory;import org.apache.catalina.util.LifecycleSupport;import org.apache.catalina.util.StringManager;/** * Implementation of an Ajp13 connector. * * @author Kevin Seguin * @version $Revision: 1.17 $ $Date: 2002/12/27 02:21:27 $ */public final class Ajp13Connector    implements Connector, Lifecycle, Runnable {    // ----------------------------------------------------- Instance Variables    /**     * The accept count for this Connector.     */    private int acceptCount = 10;    /**     * The IP address on which to bind, if any.  If <code>null</code>, all     * addresses on the server will be bound.     */    private String address = null;    /**     * The input buffer size we should create on input streams.     */    private int bufferSize = 2048;    /**     * The Container used for processing requests received by this Connector.     */    protected Container container = null;    /**     * The set of processors that have ever been created.     */    private Vector created = new Vector();    /**     * The current number of processors that have been created.     */    private int curProcessors = 0;    /**     * The debugging detail level for this component.     */    private int debug = 0;    /**     * The server socket factory for this component.     */    private ServerSocketFactory factory = null;    /**     * Descriptive information about this Connector implementation.     */    private static final String info =        "org.apache.catalina.connector.ajp.Ajp13Connector/1.0";    /**     * redirect port.     */    private int redirectPort = -1;    /**     * enable DNS lookups.     */    private boolean enableLookups = false;    /**     * The lifecycle event support for this component.     */    protected LifecycleSupport lifecycle = new LifecycleSupport(this);    /**     * The minimum number of processors to start at initialization time.     */    protected int minProcessors = 5;    /**     * The maximum number of processors allowed, or <0 for unlimited.     */    private int maxProcessors = 20;    /**     * Timeout value on the incoming connection.     * Note : a value of 0 means no timeout.     */    private int connectionTimeout = -1;    /**     * Linger value to be used on socket close.     * Note : a value of -1 means no linger used on close.     */    private int connectionLinger = -1;    /**     * The port number on which we listen for ajp13 requests.     */    private int port = 8009;    /**     * The set of processors that have been created but are not currently     * being used to process a request.     */    private Stack processors = new Stack();    /**     * The request scheme that will be set on all requests received     * through this connector.     */    private String scheme = "http";    /**     * The secure connection flag that will be set on all requests received     * through this connector.     */    private boolean secure = false;    /**     * The server socket through which we listen for incoming TCP connections.     */    private ServerSocket serverSocket = null;    /**     * The string manager for this package.     */    private StringManager sm =	StringManager.getManager(Constants.PACKAGE);    /**     * Has this component been started yet?     */    private boolean started = false;    /**     * The shutdown signal to our background thread     */    private boolean stopped = false;    /**     * The background thread.     */    private Thread thread = null;    /**     * This connector's thread group.     */    private ThreadGroup threadGroup = null;    /**     * The name to register for the background thread.     */    private String threadName = null;    /**     * A thread that periodically logs debug info if debug > 0.     */    private DebugThread debugThread = null;    /**     * The thread synchronization object.     */    private Object threadSync = new Object();    private Ajp13Logger logger = new Ajp13Logger();    /**     * The service which which the connector is associated     */    private Service service = null;    private String secret = null;    /**     * Tomcat authentication flag. If true, the authnetication is done by     * Tomcat, otherwise, it is done by the native webserver.     */    private boolean tomcatAuthentication = true;    // ------------------------------------------------------------- Properties    /**     * Return the connection timeout for this Connector.     */    public int getConnectionTimeout() {	return (connectionTimeout);    }    /**     * Set the connection timeout for this Connector.     *     * @param connectionTimeout The new connection timeout     */    public void setConnectionTimeout(int connectionTimeout) {	this.connectionTimeout = connectionTimeout;    }    /**     * Return the connection linger settings for this Connector.     */    public int getConnectionLinger() {	return (connectionLinger);    }    /**     * Set the connection linger for this Connector.     *     * @param connectionLinger The new connection linger     */    public void setConnectionLinger(int connectionLinger) {	this.connectionLinger = connectionLinger;    }    public void setSecret( String s ) {        secret=s;    }    public String getSecret() {        return secret;    }        /**     * Return the accept count for this Connector.     */    public int getAcceptCount() {	return (acceptCount);    }    /**     * Set the accept count for this Connector.     *     * @param count The new accept count     */    public void setAcceptCount(int count) {	this.acceptCount = count;    }    /**     * Return the bind IP address for this Connector.     */    public String getAddress() {	return (this.address);    }    /**     * Set the bind IP address for this Connector.     *     * @param address The bind IP address     */    public void setAddress(String address) {	this.address = address;    }    /**     * Is this connector available for processing requests?     */    public boolean isAvailable() {	return (started);    }    /**     * Return the input buffer size for this Connector.     */    public int getBufferSize() {	return (this.bufferSize);    }    /**     * Set the input buffer size for this Connector.     *     * @param bufferSize The new input buffer size.     */    public void setBufferSize(int bufferSize) {	this.bufferSize = bufferSize;    }    /**     * Return the Container used for processing requests received by this     * Connector.     */    public Container getContainer() {	return (container);    }    /**     * Set the Container used for processing requests received by this     * Connector.     *     * @param container The new Container to use     */    public void setContainer(Container container) {	this.container = container;    }    /**     * Return the current number of processors that have been created.     */    public int getCurProcessors() {	return (curProcessors);    }    /**     * Return the debugging detail level for this component.     */    public int getDebug() {        return (debug);    }    /**     * Set the debugging detail level for this component.     *     * @param debug The new debugging detail level     */    public void setDebug(int debug) {        this.debug = debug;    }    /**     * Return the "enable DNS lookups" flag.     */    public boolean getEnableLookups() {        return this.enableLookups;    }    /**     * Set the "enable DNS lookups" flag.     *     * @param enableLookups The new "enable DNS lookups" flag value     */    public void setEnableLookups(boolean enableLookups) {        this.enableLookups = enableLookups;    }    /**     * Return the port number to which a request should be redirected if     * it comes in on a non-SSL port and is subject to a security constraint     * with a transport guarantee that requires SSL.     */    public int getRedirectPort() {        return this.redirectPort;    }    /**     * Set the redirect port number.     *     * @param redirectPort The redirect port number (non-SSL to SSL)     */    public void setRedirectPort(int redirectPort) {        this.redirectPort = redirectPort;    }    /**     * Return the server socket factory used by this Container.     */    public ServerSocketFactory getFactory() {        if (this.factory == null) {            synchronized (this) {                this.factory = new DefaultServerSocketFactory();            }        }        return (this.factory);    }    /**     * Set the server socket factory used by this Container.     *     * @param factory The new server socket factory     */    public void setFactory(ServerSocketFactory factory) {        this.factory = factory;    }    /**     * Return descriptive information about this Connector implementation.     */    public String getInfo() {	return (info);    }    /**     * Return the minimum number of processors to start at initialization.     */    public int getMinProcessors() {	return (minProcessors);    }    /**     * Set the minimum number of processors to start at initialization.     *     * @param minProcessors The new minimum processors     */    public void setMinProcessors(int minProcessors) {	this.minProcessors = minProcessors;

⌨️ 快捷键说明

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