{
String option = (String)getOption(TRANSPORTS_OPTION);
if (option == null)
{
// Order is important, see #findHttpTransport()
ServerTransport transport = newWebSocketTransport();
if (transport != null)
addTransport(transport);
addTransport(newJSONTransport());
addTransport(new JSONPTransport(this));
}
else
{
for (String className : option.split(","))
{
ServerTransport transport = newServerTransport(className.trim());
if (transport != null)
addTransport(transport);
}
if (_transports.isEmpty())
throw new IllegalArgumentException("Option '" + TRANSPORTS_OPTION +
"' does not contain a valid list of server transport class names");
}
}
if (_allowedTransports.isEmpty())
{
String option = (String)getOption(ALLOWED_TRANSPORTS_OPTION);
if (option == null)
{
_allowedTransports.addAll(_transports.keySet());
}
else
{
for (String transportName : option.split(","))
{
if (_transports.containsKey(transportName))
_allowedTransports.add(transportName);
}
if (_allowedTransports.isEmpty())
throw new IllegalArgumentException("Option '" + ALLOWED_TRANSPORTS_OPTION +
"' does not contain at least one configured server transport name");
}
}
List<String> activeTransports = new ArrayList<>();
for (String transportName : _allowedTransports)
{
ServerTransport serverTransport = getTransport(transportName);
if (serverTransport instanceof AbstractServerTransport)
{
((AbstractServerTransport)serverTransport).init();
activeTransports.add(serverTransport.getName());
}
}
if (_logger.isDebugEnabled())
_logger.debug("Active transports: {}", activeTransports);
}