当前位置: 首页>>代码示例>>Java>>正文


Java ServerSocketFactory类代码示例

本文整理汇总了Java中org.apache.catalina.net.ServerSocketFactory的典型用法代码示例。如果您正苦于以下问题:Java ServerSocketFactory类的具体用法?Java ServerSocketFactory怎么用?Java ServerSocketFactory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ServerSocketFactory类属于org.apache.catalina.net包,在下文中一共展示了ServerSocketFactory类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getFactory

import org.apache.catalina.net.ServerSocketFactory; //导入依赖的package包/类
/**
 * 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);

}
 
开发者ID:c-rainstorm,项目名称:jerrydog,代码行数:14,代码来源:HttpConnector.java

示例2: open

import org.apache.catalina.net.ServerSocketFactory; //导入依赖的package包/类
/**
 * Open and return the server socket for this Connector.  If an IP
 * address has been specified, the socket will be opened only on that
 * address; otherwise it will be opened on all addresses.
 *
 * @exception IOException                input/output or network error
 * @exception KeyStoreException          error instantiating the
 *                                       KeyStore from file (SSL only)
 * @exception NoSuchAlgorithmException   KeyStore algorithm unsupported
 *                                       by current provider (SSL only)
 * @exception CertificateException       general certificate error (SSL only)
 * @exception UnrecoverableKeyException  internal KeyStore problem with
 *                                       the certificate (SSL only)
 * @exception KeyManagementException     problem in the key management
 *                                       layer (SSL only)
 */
private ServerSocket open()
throws IOException, KeyStoreException, NoSuchAlgorithmException,
       CertificateException, UnrecoverableKeyException,
       KeyManagementException
{

    // Acquire the server socket factory for this Connector
    ServerSocketFactory factory = getFactory();

    // If no address is specified, open a connection on all addresses
    if (address == null) {
        log(sm.getString("httpConnector.allAddresses"));
        return (factory.createSocket(port, acceptCount));
    }

    // Open a server socket on the specified address
    InetAddress[] addresses =
        InetAddress.getAllByName(InetAddress.getLocalHost().getHostName());
    int i;
    for (i = 0; i < addresses.length; i++) {
        if (addresses[i].getHostAddress().equals(address))
            break;
    }
    if (i < addresses.length) {
        log(sm.getString("httpConnector.anAddress", address));
        return (factory.createSocket(port, acceptCount, addresses[i]));
    } else {
        log(sm.getString("httpConnector.noAddress", address));
        return (factory.createSocket(port, acceptCount));
    }

}
 
开发者ID:c-rainstorm,项目名称:jerrydog,代码行数:49,代码来源:HttpConnector.java

示例3: storeFactory

import org.apache.catalina.net.ServerSocketFactory; //导入依赖的package包/类
/**
 * Store the specified ServerSocketFactory properties.
 *
 * @param writer PrintWriter to which we are storing
 * @param indent Number of spaces to indent this element
 * @param factory Object whose properties are being stored
 *
 * @exception Exception if an exception occurs while storing
 */
private void storeFactory(PrintWriter writer, int indent,
                          ServerSocketFactory factory) throws Exception {

    for (int i = 0; i < indent; i++) {
        writer.print(' ');
    }
    writer.print("<Factory");
    storeAttributes(writer, factory);
    writer.println("/>");

}
 
开发者ID:c-rainstorm,项目名称:jerrydog,代码行数:21,代码来源:StandardServer.java

示例4: storeConnector

import org.apache.catalina.net.ServerSocketFactory; //导入依赖的package包/类
/**
 * Store the specified Connector properties.
 *
 * @param writer PrintWriter to which we are storing
 * @param indent Number of spaces to indent this element
 * @param connector Object whose properties are being stored
 *
 * @exception Exception if an exception occurs while storing
 */
private void storeConnector(PrintWriter writer, int indent,
                            Connector connector) throws Exception {

    // Store the beginning of this element
    for (int i = 0; i < indent; i++) {
        writer.print(' ');
    }
    writer.print("<Connector");
    storeAttributes(writer, connector);
    writer.println(">");

    // Store nested <Factory> element
    ServerSocketFactory factory = connector.getFactory();
    if (factory != null) {
        storeFactory(writer, indent + 2, factory);
    }

    // Store nested <Listener> elements
    if (connector instanceof Lifecycle) {
        LifecycleListener listeners[] =
            ((Lifecycle) connector).findLifecycleListeners();
        if (listeners == null) {
            listeners = new LifecycleListener[0];
        }
        for (int i = 0; i < listeners.length; i++) {
            if (listeners[i].getClass().getName().equals
                (SERVER_LISTENER_CLASS_NAME)) {
                continue;
            }
            storeListener(writer, indent + 2, listeners[i]);
        }
    }

    // Store the ending of this element
    for (int i = 0; i < indent; i++) {
        writer.print(' ');
    }
    writer.println("</Connector>");

}
 
开发者ID:c-rainstorm,项目名称:jerrydog,代码行数:50,代码来源:StandardServer.java

示例5: getFactory

import org.apache.catalina.net.ServerSocketFactory; //导入依赖的package包/类
@Override
public ServerSocketFactory getFactory() {
	// TODO Auto-generated method stub
	return null;
}
 
开发者ID:Saisimon,项目名称:tip,代码行数:6,代码来源:HttpConnector.java

示例6: setFactory

import org.apache.catalina.net.ServerSocketFactory; //导入依赖的package包/类
@Override
public void setFactory(ServerSocketFactory factory) {
	// TODO Auto-generated method stub
	
}
 
开发者ID:Saisimon,项目名称:tip,代码行数:6,代码来源:HttpConnector.java

示例7: setFactory

import org.apache.catalina.net.ServerSocketFactory; //导入依赖的package包/类
/**
 * Set the server socket factory used by this Container.
 *
 * @param factory The new server socket factory
 */
public void setFactory(ServerSocketFactory factory) {

    this.factory = factory;

}
 
开发者ID:c-rainstorm,项目名称:jerrydog,代码行数:11,代码来源:HttpConnector.java

示例8: getFactory

import org.apache.catalina.net.ServerSocketFactory; //导入依赖的package包/类
/**
 * Return the server socket factory used by this Container.
 */
public ServerSocketFactory getFactory();
 
开发者ID:c-rainstorm,项目名称:jerrydog,代码行数:5,代码来源:Connector.java

示例9: setFactory

import org.apache.catalina.net.ServerSocketFactory; //导入依赖的package包/类
/**
 * Set the server socket factory used by this Container.
 *
 * @param factory The new server socket factory
 */
public void setFactory(ServerSocketFactory factory);
 
开发者ID:c-rainstorm,项目名称:jerrydog,代码行数:7,代码来源:Connector.java


注:本文中的org.apache.catalina.net.ServerSocketFactory类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。