} catch (IllegalArgumentException e) {
throw new GadgetException(GadgetException.Code.INVALID_PARAMETER, "Invalid "
+ Param.URL.getKey() + " parameter", HttpResponse.SC_BAD_REQUEST);
}
SecurityToken token = AuthInfoUtil.getSecurityTokenFromRequest(request);
String container = null;
Uri gadgetUri = null;
if ("1".equals(getParameter(request, MULTI_PART_FORM_POST, null))) {
// This endpoint is being used by the proxied-form-post feature.
// Require a token.
if (token == null) {
throw new GadgetException(GadgetException.Code.INVALID_SECURITY_TOKEN);
}
}
// If we have a token, we should use it.
if (token != null && !token.isAnonymous()) {
container = token.getContainer();
String appurl = token.getAppUrl();
if (appurl != null) {
gadgetUri = Uri.parse(appurl);
}
} else {
container = getContainer(request);