Configure server socket factories
This topic has not yet been written. The content below is from the topic description.
For ServerSocketFactorys, there are ten options for programmatic configuration: Get the ServerInvoker by calling Connector.getServerInvoker() and call ServerInvoker.setServerSocketFactory(). Call Connector.setServerSocketFactory(). Put a constructed ServerSocketFactory in a configuration map, using key Remoting.CUSTOM_SERVER_SOCKET_FACTORY, and pass the map to one of the Connector constructors. Create an xml document with root element , setting the attribute to the name of a ServerSocketFactoryMBean and pass the document to Connector.setConfiguration(). For example: StringBuffer buf = new StringBuffer(); buf.append("\n"); buf.append(""); buf.append(" "); buf.append(" " + getHostName() + ""); buf.append(" " + freeport + ""); buf.append(" " + socketFactoryObjName + ""); buf.append(" "); buf.append(""); ByteArrayInputStream bais = new ByteArrayInputStream(buf.toString().getBytes()); Document xml = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(bais); connector.setConfiguration(xml.getDocumentElement()); Create an xml document with root element , setting the attribute to the class name of a ServerSocketFactory and pass the document to Connector.setConfiguration(). The class must have a default constructor, which will be used to create a ServerSocketFactory. Put the ObjectName of a ServerSocketFactoryMBean in a configuration map, using key ServerInvoker.SERVER_SOCKET_FACTORY, and pass the map to one of the Connector constructors. Put the class name of a ServerSocketFactory in a configuration map, using key ServerInvoker.SERVER_SOCKET_FACTORY, and pass the map to one of the Connector constructors. The class must have a default constructor, which will be used to create a ServerSocketFactory. Put a set of SSL parameters, using the keys in org.jboss.remoting.security.SSLSocketBuilder, in a configuration map and pass the map to one of the Connector constructors. These will be used by SSLSocketBuilder (see below) to create a CustomSSLServerSocketFactory. Configure an appropriate set of SSL system properties and use one of the SSL transports (https, sslrmi, or sslsocket). The properties will be used to create some kind of SSLServerSocketFactory, as determined by the transport. Use one of the non-SSL transports and do nothing. A default ServerSocketFactory will be constructed. These options are essentially in descending order of precedence. If options 3 and 6, for example, are both used, the factory passed in option 3 will prevail. Options 4 and 5 are mutually exclusive, as are options 6 and 7. Options 1, 2, 3, 5, and 7 are illustrated in FactoryConfigSample and options 4, 6, 8, and 9 are illustrated in FactoryConfigSSLSample, both of which are in package org.jboss.remoting.samples.config.factories. Timing considerations. The ServerInvoker, for any transport, is created during the call to Connector.create(), before which option 1 is unavailable. Option 2, on the other hand, is only available before the call to Connector.create(). Once the ServerInvoker has been created, it selects a ServerSocketFactory, according to the rules enumerated above, during the create() phase. For all current transports, the actual ServerSocket is created during the call to Connector.start(), so that a call to ServerInvoker.setServerSocketFactory() (option 1) can override the selected ServerSocketFactory until Connector.start() is called.