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

📄 configuration.java

📁 一个经典的java的web服务器的建立源代码
💻 JAVA
字号:
// $Id: Configuration.java,v 1.23 2001/01/25 02:05:59 nconway Exp $
package tornado;
import java.io.File;

public class Configuration {
    private final int[] ports = {8080};
    private final int startThreads = 15;
    private final int maxThreads = 100;
    private final int minIdleThreads = 5;
    private final int maxIdleThreads = 10;
    private final int logLevel = Logger.DEBUG_PRIO;
    private final String documentRoot = "/home/nconway/website";
    private final String version = "0.2.1";
    private final String versionSignature = "Tornado/" + version;
    private final File errorLog =
                new File("/tmp/tornado-logs/error");
    private final File accessLog =
                new File("/tmp/tornado-logs/access");
    private final File mimeTypes = new File("/home/nconway/tornado/conf/mime.types");

    /** Parses the specified config file.*/
    Configuration(File confFile) {
        ;
    }

    /** Returns the local ports the server is running on.*/
    public final int[] getPorts() {
        return ports;
    }

    /** Returns the priority of messages that are accepted. Any
      * log messages with a lower priority than this are ignored.
      */
    public final int getLogLevel() {
        return logLevel;
    }

    /** Returns the root of the HTTP virtual filesystem.*/
    public final String getDocumentRoot() {
        return documentRoot;
    }

    /** Returns the server's signature. This is specified by the
      * HTTP standard, and consists of the name of the software,
      * and the revision, as well as any additional components.
      */
    public final String getVersionSig() {
        return versionSignature;
    }

    /** Returns the version number of the server. This is the plain
      * of the server, without any additional tags or identifiers.
      */
    public final String getVersion() {
        return version;
    }

    /** Returns the number of <code>ServerThread</code>s spawned
      * at startup. Obviously, the number of active threads will
      * change throughout the lifetime of the server.
      */
    public final int getStartThreads() {
        return startThreads;
    }

    /** Returns the maximum number of <code>ServerThread</code>s
      * that will ever be running concurrently.
      */
    public final int getMaxThreads() {
        return maxThreads;
    }

    /** Returns the minimum number of idle threads. If there are
      * fewer idle threads available than this, new instances
      * of <code>ServerThread</code> will be spawned by the
      * <code>ThreadManager</code> at a rate of 2 per second
      * until we reach <code>maxIdleThreads</code>.
      *     @see #getMaxIdleThreads()
      *     @see tornado.ThreadManager
      */
    public final int getMinIdleThreads() {
        return minIdleThreads;
    }

    /** Returns the maximum number of idle threads. If there
      * are more idle threads than this, they are killed
      * by the <code>ThreadManager</code>.
      *     @see #getMinIdleThreads()
      *     @see tornado.ThreadManager
      */
    public final int getMaxIdleThreads() {
        return maxIdleThreads;
    }

    /** Returns the <code>File</code> to use for error logging.*/
    public final File getErrorLog() {
        return errorLog;
    }

    /** Returns the <code>File</code> to use for access logging.*/
    public final File getAccessLog() {
        return accessLog;
    }

    public final File getMimeTypes() {
        return mimeTypes;
    }
}

⌨️ 快捷键说明

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