.getLength(); j++) {
final Node childNode2 = childNode
.getChildNodes().item(j);
if (isParameter(childNode2)) {
Parameter p = parseParameter(childNode2);
if (p != null) {
client.getContext().getParameters()
.add(p);
}
}
}
}
} else if ("server".equals(childNode.getNodeName())) {
Node item = childNode.getAttributes().getNamedItem(
"protocol");
final Node portNode = childNode.getAttributes()
.getNamedItem("port");
final Node addressNode = childNode.getAttributes()
.getNamedItem("address");
Server server = null;
if (item == null) {
item = childNode.getAttributes().getNamedItem(
"protocols");
if (item != null) {
final String[] protocols = item.getNodeValue()
.split(" ");
final List<Protocol> protocolsList = new ArrayList<Protocol>();
for (final String protocol : protocols) {
protocolsList.add(getProtocol(protocol));
}
final int port = getInt(portNode,
Protocol.UNKNOWN_PORT);
if (port == Protocol.UNKNOWN_PORT) {
getLogger()
.warning(
"Please specify a port when defining a list of protocols.");
} else {
server = new Server(new Context(),
protocolsList, getInt(portNode,
Protocol.UNKNOWN_PORT),
getComponent().getServers()
.getNext());
}
}
} else {
final Protocol protocol = getProtocol(item
.getNodeValue());
server = new Server(
new Context(),
protocol,
getInt(portNode, protocol.getDefaultPort()),
getComponent().getServers().getNext());
}
if (server != null) {
// Look for Restlet's attributes
parseRestlet(server, childNode);
if (addressNode != null) {
final String address = addressNode
.getNodeValue();
if (address != null) {
server.setAddress(address);
}
}
// Look for parameters
for (int j = 0; j < childNode.getChildNodes()
.getLength(); j++) {
final Node childNode2 = childNode
.getChildNodes().item(j);
if (isParameter(childNode2)) {
Parameter p = parseParameter(childNode2);
if (p != null) {
server.getContext().getParameters()
.add(p);
}
}
}
getComponent().getServers().add(server);
}
} else if (isParameter(childNode)) {
Parameter p = parseParameter(childNode);
if (p != null) {
getComponent().getContext().getParameters().add(p);
}
} else if ("defaultHost".equals(childNode.getNodeName())) {