throw new RuntimeException(e);
}
String host = "//" +
(ldDomain == null ? getReqVal(container, UNLOCKED_DOMAIN_KEY) : ldDomain);
Uri gadgetUri = Uri.parse(host);
if (gadgetUri.getAuthority() == null
&& gadgetUri.getScheme() == null
&& gadgetUri.getPath().equals(host)) {
// This is for backwards compatibility with unlocked domains like
// "unlockeddomain.com"
gadgetUri = Uri.parse("//" + host);
}
// 3. Set the scheme.
if (StringUtils.isBlank(gadgetUri.getScheme())) {
uri.setScheme(getScheme(gadget, container));
} else {
uri.setScheme(gadgetUri.getScheme());
}
// 4. Set the authority.
uri.setAuthority(gadgetUri.getAuthority());
// 5. Add the URL.
uri.addQueryParameter(Param.URL.getKey(), context.getUrl().toString());
}