title: Get response file use ExtJS
body: <p>I use ExtJS to build the client-side for my program. There's a situation that I want to send an Ajax request to server, and get the response file (binary file, not plain text file, i.e XLS or PDF). How can I get that returned file by ExtJS (I mean that file can be downloaded and stored to client)? I cannot use <code>var result = Ext.decode(response.responseText)</code> to receive the result because reponse contains binary data and it cannot be decoded.</p>
  
  <p>The Ajax call is very simple :</p>
  
  <pre><code>Ext.Ajax.request({
      url : 'myController/exportFile',
      method : 'GET',
      success : function(response, opts) {
          // What should I do to get the file?
      },
      failure : function(response, opts) {
          alert('Export file failed!')
      }
  });
  </code></pre>
  
  <p>Here is my server action to return file:</p>
  
  <pre><code>public void sendFile(HttpServletResponse response, String filePath) {
          def file = new File(filePath);
          response.setContentType("application/octet-stream");
          response.setHeader("Content-disposition", "attachment;filename=${file.getName()}");     
          response.outputStream &lt;&lt; file.newInputStream();
      }
  </code></pre>
  
  <p>Thank you so much!</p>