Content-Type: application
Hi,
I need to return an application file (f.i. doc or pdf) from a DWR-managed service bean. The bean serializes the file content into the HTTP response and sets appropriate response headers (Content-Type and Content-Disposition). If the DWR service call is made using options httpMethod: 'GET' and responseType: 'dwr.engine.IFrame', the hidden iframe would handle the file content by displaying standard Open or Save As dialog box.
There is one little issue though. The dwr.engine._validateBatch() JavaScript function checks for unresolved batch handlers, finds one (because the response does not contain typical DWR-generated JavaScript code that calls the handler), and calls the error handling. This stops the browser from finishing the HTTP response processing.
Would it be a good idea to provide a batch-level option that would suppress this default behavior and simply call the unresolved batch handler?
if (typeof(batch.validateIncompleteReply) == 'undefined' || batch.validateIncompleteReply) {
dwr.engine._handleWarning(batch, { name:"dwr.engine.incompleteReply", message:"Incomplete reply from server" });
break;
} else {
batch.handlers[i].callback();
batch.handlers[i] = null;
}