Example - pass an XML document to the Connector
A fourth option, which exists primarily to support the declarative mode of configuration presented below, is to pass an XML document to the Connector. The following fragment duplicates the behavior of the first and second examples above. HashMap config = new HashMap(); config.put(ServerInvoker.TIMEOUT, "120000"); Connector connector = new Connector(config); // Set xml configuration element. StringBuffer buf = new StringBuffer(); buf.append(" \n"); buf.append(" "); buf.append(" "); buf.append(" test.somedomain.com"); buf.append(" 8084"); buf.append(" 10000"); buf.append(" "); buf.append(" "); buf.append(" "); buf.append(" org.jboss.remoting.transport.mock.SampleInvocationHandler"); buf.append(" "); buf.append(" "); buf.append(""); ByteArrayInputStream bais = new ByteArrayInputStream(buf.toString().getBytes()); Document xml = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(bais); connector.setConfiguration(xml.getDocumentElement()); connector.create(); connector.start(); Note that there is no InvokerLocator in this example. If the Connector gets an InvokerLocator, it ignores the presence of the xml document. Note also that this method only supports the use of string values, so it is necessary to include the fully qualified name of the invocation handler, from which the handler is created by calling the default constructor.