Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    DMI file download IE error

    SmartGWT 3.0
    v8.2p_2012-10-11/PowerEdition Deployment (built 2012-10-11)


    Hello,

    I am downloading files from the server via DMI and I am stuck on the IE Error attached ("IE cannot download IDACall ...")
    When this error occurs, my application is non-responsive and I have to hit refresh. Upon refresh, it would appear that the download works as expected without IE errors.

    Looking this error up online, I did find some stuff with regards to downloading files over https with cache preventing headers but unfortunately that is not my case.


    I am sure that the following DMI method executes successfully with no exceptions thrown.

    Code:
    public void downloadFile(final DSRequest dsRequest,
                          final HttpServletRequest request)
    {
            dsRequest.rpc.doCustomResponse();
            final HttpServletResponse servletResponse = 
    			dsRequest.rpc.getContext().response;
    
            long fileId = 0;
    
            if(dsRequest.getCriteria().get("fileId") != null &&
                    !"".equals(dsRequest.getCriteria().get("fileId").toString()))
            {
                fileId = Long.parseLong(dsRequest.getCriteria().get("fileId").toString());
            }
    
            AssociatedFileDto fileDto = null;
            try
            {
                fileDto = situationService.retrieveAssociatedFileById(fileId);
                if(fileDto != null)
                {
                    final byte[] bytes = fileDto.getData();
                    final String filename = fileDto.getFileName();
                    servletResponse.setHeader("Pragma", "private");
                    servletResponse.setHeader("Cache-Control", "private, must-revalidate");
                    if("text/plain".equals(fileDto.getMimeType()))
                    {
                        servletResponse.setContentType("text/html");
                    }
                    else
                    {
                        servletResponse.setContentType(fileDto.getMimeType());
                    }
                    servletResponse.setHeader("Content-Disposition", "attachment; filename="+ filename);
                    servletResponse.setContentLength(bytes.length);
                    servletResponse.getOutputStream().write(bytes);
                }
            }
            catch (final Exception e)
            {
                logger.error("There was an error while retrieving associated file with id: {}",fileId,e);
            }
    }
    Below is the piece of code on the front end that makes the request
    Code:
    DSRequest requestProperties = new DSRequest();
    requestProperties.setDownloadResult(true);
    requestProperties.setOperationId("downloadFile");
    DataSourceFactory.getSitDetailsAssoFilesDataSource()
    		.fetchData(new Criteria("fileId", fileId),null,requestProperties);
    This is obviously not a defect with regards to SmartGWT rather than me missing something. Maybe configuration wise?
    Any suggestions would be much appreciated

    Regards,
    Stathis
    Attached Files
    Last edited by etask; 23 Jul 2013, 10:51.

    #2
    I am only able to reproduce when ChromeFrame plugin is enabled. Great.

    Comment


      #3
      Upgrading to SmartGWT 3.1 solves the problem.

      When I have some time I will try to put up a reproducible standalone testcase but I doubt it is worth it due to the fact that ChromeFrame is used

      Comment

      Working...
      X