in extensions/guacamole-auth-quickconnect/src/main/java/org/apache/guacamole/auth/quickconnect/utility/QCParser.java [114:168]
public GuacamoleConfiguration getConfiguration(String uri)
throws GuacamoleException {
// Parse the provided String into a URI object.
URI qcUri;
try {
qcUri = new URI(uri);
if (!qcUri.isAbsolute())
throw new TranslatableGuacamoleClientException("URI must be absolute.",
"QUICKCONNECT.ERROR_NOT_ABSOLUTE_URI");
}
catch (URISyntaxException e) {
throw new TranslatableGuacamoleClientException("Invalid URI Syntax",
"QUICKCONNECT.ERROR_INVALID_URI");
}
// Break out individual components of the URI.
String protocol = qcUri.getScheme();
String host = qcUri.getHost();
int port = qcUri.getPort();
String userInfo = qcUri.getUserInfo();
String query = qcUri.getQuery();
// Generate a new GuacamoleConfiguration
GuacamoleConfiguration qcConfig = new GuacamoleConfiguration();
// Check for protocol and set it, or throw an error if not present
if (protocol != null && !protocol.isEmpty())
qcConfig.setProtocol(protocol);
else
throw new TranslatableGuacamoleClientException("No protocol specified.",
"QUICKCONNECT.ERROR_NO_PROTOCOL");
// Check for provided port number
if (port > 0 && paramIsAllowed("port"))
qcConfig.setParameter("port", Integer.toString(port));
// Check for provided host, or throw an error if not present
if (host != null && !host.isEmpty() && paramIsAllowed("hostname"))
qcConfig.setParameter("hostname", host);
else
throw new TranslatableGuacamoleClientException("No host specified.",
"QUICKCONNECT.ERROR_NO_HOST");
// Look for extra query parameters and parse them out.
if (query != null && !query.isEmpty())
parseQueryString(query, qcConfig);
// Look for the username and password and parse them out.
if (userInfo != null && !userInfo.isEmpty())
parseUserInfo(userInfo, qcConfig);
return qcConfig;
}