Announcement

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

    file download

    Currently, our download functionality is to open the file download window using window.open("......"). This has become a problem with applications in https because IE has added security regarding file download popups. My question is, is there something in the SC library that I can use instead to request for downloads?

    The sequence of events:

    1. User selects a row in a listgrid.
    2. User clicks on "Open" menu.
    3. Menu action does a server request, a download path is generated, and sent back to client code. This value is then used as parameter in window.open.

    I want to avoid having to use window.open.

    #2
    A couple of approaches:

    1. you can assign the URL to window.location. As long as you set the HTTP header Content-Disposition: Attachment, this will trigger a "Save As" dialog and will not destroy the current application page. The downside of this is that any kind of error result (HTTP 500 for example) will destroy the current page.

    2. you can use rpcRequest.downloadResult to cause file download to be performed in a hidden frame. In your server code, write a DMI that calls RPCManager.doCustomResponse() and streams data back via the servletRequest. Here again the user will see a "Save As" dialog.

    Both approaches obviously cannot be used for files where you want some kind of native browser viewer or browser plugin to appear inside a browser window (such as a .pdf viewer) - they will only work if a "Save As" dialog is the intended result of the download.

    Comment


      #3
      Ok. I am trying to do #2. I have the following code instead of window.open just to test that it goes back to our DispatchServlet, but it does not. Am I in the right path so far? I Also don't see it in the RPC History

      Code:
           $wnd.isc.RPCManager.sendRequest({
              downloadResult : true,
              actionURL: "/cwf/d"
          });

      Comment


        #4
        Any suggestions?

        Comment


          #5
          That code has to either crash, result in a warning, or send a request. So look in the Developer Console as usual. We'd also recommend trying this outside of your special GWT environment to eliminate that as a cause.

          Comment


            #6
            Yes, this piece of code works now. Thanks.

            Comment

            Working...
            X