Quantcast
Channel: SmartClient Forums
Viewing all articles
Browse latest Browse all 4756

save external binary data

$
0
0
My SmartGWT application connects to external web-application, which generates jasper report in XLS format. This web-application returns binary data (XLS file) or error message, therefore I cannot use just Window.open feature from GWT. How can I offer save dialog with downloaded "rawData"?

Code:

RPCRequest req = new RPCRequest();
req.setActionURL("http://myservlet/");
RPCManager.sendRequest(req, new RPCCallback()
{
  @Override
  public void execute(RPCResponse response, Object rawData, RPCRequest request)
  {
    String contentType = ((String)response.getHttpHeaders().get("Content-Type"));
   
    // if error msg
    if (contentType != null && contentType.contains("text/html"))
    {
      // show error msg
      SC.info("Error message: " + rawData);   
    }
    else
    {
      // want to save downloaded file (rawData)
    }
  }
});


Viewing all articles
Browse latest Browse all 4756

Trending Articles