// Get the QP lookup for this form
final String requestData = this.decode(request.getParameter(this.getGetLookupKey(formName)));
if (StringUtils.isBlank(requestData)) {
return new Form(formName, request.getResource().getPath());
}
try {
final JSONObject jsonData = new JSONObject(requestData);
final String incomingFormName = jsonData.optString(KEY_FORM_NAME);
// Double-check the form names; only inject matching forms
if (StringUtils.equals(incomingFormName, formName)) {
final JSONObject incomingJsonForm = jsonData.optJSONObject(KEY_FORM);
if (incomingJsonForm != null) {
data = TypeUtil.toMap(incomingJsonForm, String.class);
log.debug("Form data: {}", data);
}
final JSONObject incomingJsonErrors = jsonData.optJSONObject(KEY_ERRORS);
if (incomingJsonErrors != null) {
errors = TypeUtil.toMap(incomingJsonErrors, String.class);
log.debug("Form data: {}", errors);
}
}
} catch (JSONException e) {
log.warn("Cannot parse query parameters for request: {}", requestData);
return new Form(formName, request.getResource().getPath());
}
return new Form(formName,
request.getResource().getPath(),
this.getProtectedData(data),
this.getProtectedErrors(errors));
}