public void deserialize( PropertyContext propertyContext, ConnectionResult connectionResult, XFormsModelSubmission.SubmissionParameters p, XFormsModelSubmission.SecondPassParameters p2) throws Exception { // Deserialize here so it can run in parallel if (XMLUtils.isXMLMediatype(connectionResult.getResponseMediaType())) { // XML media type final IndentedLogger detailsLogger = getDetailsLogger(p, p2); resultingDocument = deserializeInstance( propertyContext, detailsLogger, p2.isReadonly, p2.isHandleXInclude, connectionResult); } else { // Other media type is not allowed throw new XFormsSubmissionException( submission, "Body received with non-XML media type for replace=\"instance\": " + connectionResult.getResponseMediaType(), "processing instance replacement", new XFormsSubmitErrorEvent( containingDocument, propertyContext, submission, XFormsSubmitErrorEvent.ErrorType.RESOURCE_ERROR, connectionResult)); } }
public void deserialize( ConnectionResult connectionResult, XFormsModelSubmission.SubmissionParameters p, XFormsModelSubmission.SecondPassParameters p2) throws IOException { responseBody = connectionResult.getTextResponseBody(); if (responseBody == null) { // This is a binary result // Don't store anything for now as per the spec, but we could do something better by going // beyond the spec // NetUtils.inputStreamToAnyURI(pipelineContext, connectionResult.resultInputStream, // NetUtils.SESSION_SCOPE); // XForms 1.1: "For a success response including a body that is both a non-XML media type // (i.e. with a // content type not matching any of the specifiers in [RFC 3023]) and a non-text type (i.e. // with a content // type not matching text/*), when the value of the replace attribute on element submission is // "text", // nothing in the document is replaced and submission processing concludes after dispatching // xforms-submit-error with appropriate context information, including an error-type of // resource-error." throw new XFormsSubmissionException( submission, "Mediatype is neither text nor XML for replace=\"text\": " + connectionResult.getResponseMediaType(), "reading response body", new XFormsSubmitErrorEvent( containingDocument, submission, XFormsSubmitErrorEvent.ErrorType.RESOURCE_ERROR, connectionResult)); } }