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

📄 basicserverconfig.java

📁 一个用java编写的服务器,对于学习网络编程的人来说是个很好的例子
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
	 */
	public void setMaxAuthTryMsg(String msg) {
		if(msg!=null && msg.equals("")==false)
			maxAuthTryMsg = msg;
	}
	/** 
	 * Returns message to be displayed when maximum allowed login 
	 * attempts has reached.
	 * @see #getMaxAuthTryMsg
	 */
	public String getMaxAuthTryMsg() {
		return maxAuthTryMsg;
	}

	/**
	 * Sets timeout message. 
	 * Default is : -ERR Timeout<br/>
	 * XML Tag: &lt;timeout-msg&gt;&lt;/timeout-msg&gt;
	 * @see #getTimeoutMsg
	 */
	public void setTimeoutMsg(String msg) {
		if(msg!=null && msg.equals("")==false)
			timeoutMsg = msg;
	}
	/** 
	 * Returns timeout message.
	 * @see #setTimeoutMsg
	 */
	public String getTimeoutMsg() {
		return timeoutMsg;
	}

	/**
	 * Sets the maximum number of client connection allowed..
	 * XML Tag: &lt;max-connection&gt;&lt;/max-connection&gt;
	 * @see #getMaxConnection
	 */
	public void setMaxConnection(long maxConnection) {
		this.maxConnection = maxConnection;
	}
	/** 
	 * Returns the maximum number of client connection allowed.
	 * @see #setMaxConnection
	 */
	public long getMaxConnection() {
		return maxConnection;
	}

	/**
	 * Sets the message to be sent to any new client connected after
	 * maximum client connection has reached. 
	 * Default is : <code>-ERR Server Busy. Max Connection Reached</code><br/>
	 * XML Tag: &lt;max-connection-msg&gt;&lt;/max-connection-msg&gt;
	 * @see #getMaxConnectionMsg
	 */
	public void setMaxConnectionMsg(String maxConnectionMsg) {
		if(maxConnectionMsg!=null && maxConnectionMsg.equals("")==false)
			this.maxConnectionMsg = maxConnectionMsg;
	}
	/**
	 * Returns the message to be sent to any new client connected 
	 * after maximum client connection has reached.
	 * @see #setMaxConnectionMsg
	 */
	public String getMaxConnectionMsg() {
		return maxConnectionMsg;
	}

	/**
	 * Sets the Ip address to bind to. 
	 * @param bindAddr argument can be used on a multi-homed host for a 
	 * QuickServer that will only accept connect requests to one 
	 * of its addresses. If not set, it will default accepting 
	 * connections on any/all local addresses.
	 * XML Tag: &lt;bind-address&gt;&lt;/bind-address&gt;
	 * @see #getBindAddr
	 */
	public void setBindAddr(String bindAddr) {
		if(bindAddr!=null && bindAddr.equals("")==false)
			this.bindAddr = bindAddr;
	}
	/**
	 * Returns the Ip address binding to. 
	 * @see #setBindAddr
	 */
	public String getBindAddr() {
		return bindAddr;
	}

	/**
     * Sets the ClientObjectHandler class that interacts with 
	 * client sockets.
	 * XML Tag: &lt;client-object-handler&gt;&lt;/client-object-handler&gt;
	 * @param handler object the fully qualified name of the class that 
	 *  implements {@link org.quickserver.net.server.ClientObjectHandler}
	 * @see #getClientObjectHandler
     */
	public void setClientObjectHandler(String handler) {
		if(handler!=null && handler.equals("")==false)
			clientObjectHandler = handler;
	}
	/**
     * Sets the ClientObjectHandler class that interacts with 
	 * client sockets.
	 * @since 1.4.6
     */
	public void setClientObjectHandler(ClientObjectHandler handler) {
		if(handler!=null)
			clientObjectHandler = handler.getClass().getName();
	}
	/**
     * Returns the ClientObjectHandler class that interacts with 
	 * client sockets.
	 * @see #setClientObjectHandler
     */
	public String getClientObjectHandler() {
		return clientObjectHandler;
	}

	/**
	 * Sets the console log handler level.
	 * XML Tag: &lt;console-logging-level&gt;&lt;/console-logging-level&gt;
	 * @param level like INFO, FINE, CONFIG
	 */
	public void setConsoleLoggingLevel(String level) {
		if(level!=null && level.equals("")==false)
			consoleLoggingLevel = level;
	}
	/**
	 * Returns the console log handler level.
	 */
	public String getConsoleLoggingLevel() {
		return consoleLoggingLevel;
	}

	/**
	 * Sets the console log handler formatter.
	 * XML Tag: &lt;console-logging-formatter&gt;&lt;/console-logging-formatter&gt;
	 * @param formatter fully qualified name of the class that 
	 *  implements {@link java.util.logging.Formatter}
	 */
	public void setConsoleLoggingFormatter(String formatter) {
		if(formatter!=null && formatter.equals("")==false)
			consoleLoggingFormatter = formatter;
	}
	/**
	 * Returns the console log handler level.
	 */
	public String getConsoleLoggingFormatter() {
		return consoleLoggingFormatter;
	}

	/**
	 * Sets the ObjectPool Config object.
	 * XML Tag: &lt;object-pool&gt;&lt;/object-pool&gt;
	 */
	public void setObjectPoolConfig(ObjectPoolConfig objectPoolConfig) {
		if(objectPoolConfig!=null)
			this.objectPoolConfig = objectPoolConfig;
	}
	/**
	 * Returns the ObjectPool Config object.
	 */
	public ObjectPoolConfig getObjectPoolConfig() {
		return objectPoolConfig;
	}

	/**
	 * Sets the communication logging flag.
	 * @see #getCommunicationLogging
	 * XML Tag: &lt;communication-logging&gt;&lt;enable&gt;true&lt;/enable&gt;&lt;/communication-logging&gt;
	 * Allowed values = <code>true</code> | <code>false</code>
	 * @since 1.3.2
	 */
	public void setCommunicationLogging(boolean enable) {
		this.communicationLogging = enable;
	}
	/**
	 * Returns the communication logging flag.
	 * @see #setCommunicationLogging
	 * @since 1.3.2
	 */
	public boolean getCommunicationLogging() {
		return communicationLogging;
	}

	/**
	 * Sets the Access constraints
	 * @since 1.3.3
	 */
	public void setAccessConstraintConfig(
		AccessConstraintConfig accessConstraintConfig) {
		this.accessConstraintConfig = accessConstraintConfig;
	}
	/**
	 * Returns Access constraints if present else <code>null</code>.
	 * @since 1.3.3
	 */
	public AccessConstraintConfig getAccessConstraintConfig() {
		return accessConstraintConfig;
	}

	/**
	 * Sets the ServerHooks
	 * @since 1.3.3
	 */
	public void setServerHooks(ServerHooks serverHooks) {
		this.serverHooks = serverHooks;
	}
	/**
	 * Returns ServerHooks if present else <code>null</code>.
	 * @since 1.3.3
	 */
	public ServerHooks getServerHooks() {
		return serverHooks;
	}

	/**
	 * Sets the Secure setting for QuickServer
	 * @since 1.4.0
	 */
	public void setSecure(Secure secure) {
		this.secure = secure;
	}
	/**
	 * Returns Secure setting for QuickServer
	 * @since 1.4.0
	 */
	public Secure getSecure() {
		return secure;
	}

	/**
     * Sets the ClientBinaryHandler class that interacts with 
	 * client sockets.
	 * XML Tag: &lt;client-binary-handler&gt;&lt;/client-binary-handler&gt;
	 * @param handler the fully qualified name of the class that 
	 *  implements {@link org.quickserver.net.server.ClientBinaryHandler}
	 * @see #getClientBinaryHandler
     */
	public void setClientBinaryHandler(String handler) {
		if(handler!=null && handler.equals("")==false) 
			clientBinaryHandler = handler;
	}
	/**
     * Sets the ClientBinaryHandler class that interacts with 
	 * client sockets.
	 * @since 1.4.6
     */
	public void setClientBinaryHandler(ClientBinaryHandler handler) {
		if(handler!=null) 
			clientBinaryHandler = handler.getClass().getName();
	}
	/**
     * Returns the ClientBinaryHandler class that interacts with 
	 * client sockets.
	 * @see #setClientBinaryHandler
     */
	public String getClientBinaryHandler() {
		return clientBinaryHandler;
	}	

	/**
     * Sets the ServerMode for the QuickServer.
	 * @param serverMode ServerMode object.
     * @see #getServerMode
	 * @since 1.4.5
     */
	public void setServerMode(ServerMode serverMode) {
		if(serverMode==null) serverMode = new ServerMode();
		this.serverMode = serverMode;
	}
	/**
     * Returns the ServerMode for the QuickServer.
     * @see #setServerMode
	 * @since 1.4.5
     */
	public ServerMode getServerMode() {
		return serverMode;
	}

	/**
     * Sets the ClientWriteHandler class that interacts with 
	 * client sockets.
	 * XML Tag: &lt;client-write-handler&gt;&lt;/client-write-handler&gt;
	 * @param handler the fully qualified name of the class that 
	 *  implements {@link org.quickserver.net.server.ClientWriteHandler}
	 * @see #getClientWriteHandler
	 * @since 1.4.5
     */
	public void setClientWriteHandler(String handler) {
		if(handler!=null && handler.equals("")==false) 
			clientWriteHandler = handler;
	}
	/**
     * Sets the ClientWriteHandler class that interacts with 
	 * client sockets.
	 * @since 1.4.6
     */
	public void setClientWriteHandler(ClientWriteHandler handler) {
		if(handler!=null) 
			clientWriteHandler = handler.getClass().getName();
	}	
	/**
     * Returns the ClientWriteHandler class that interacts with 
	 * client sockets.
	 * @see #setClientWriteHandler
     */
	public String getClientWriteHandler() {
		return clientWriteHandler;
	}

	/**
     * Sets the AdvancedSettings for the QuickServer.
	 * @param advancedSettings AdvancedSettings object.
     * @see #getAdvancedSettings
	 * @since 1.4.5
     */
	public void setAdvancedSettings(AdvancedSettings advancedSettings) {
		this.advancedSettings = advancedSettings;
	}
	/**
     * Returns the AdvancedSettings for the QuickServer.
     * @see #setAdvancedSettings
	 * @since 1.4.5
     */
	public AdvancedSettings getAdvancedSettings() {
		if(advancedSettings==null) advancedSettings = new AdvancedSettings();
		return advancedSettings;
	}

	/**
     * Sets the DefaultDataMode for the QuickServer.
	 * @param defaultDataMode DefaultDataMode object.
     * @see #getDefaultDataMode
	 * @since 1.4.6
     */
	public void setDefaultDataMode(DefaultDataMode defaultDataMode) {
		this.defaultDataMode = defaultDataMode;
	}
	/**
     * Returns the DefaultDataMode for the QuickServer.
     * @see #setDefaultDataMode
	 * @since 1.4.6
     */
	public DefaultDataMode getDefaultDataMode() {
		if(defaultDataMode==null) 
			defaultDataMode = new DefaultDataMode();
		return defaultDataMode;
	}
}

⌨️ 快捷键说明

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