5 Replies Latest reply on Jan 29, 2009 5:35 AM by Nick Belaevski

    Binary response on ajax request

    Alexey Koloskov Newbie

      Hello!

      I want to provide a binary response (i.e. send file) in an action listener on an ajax request, but a browser opens this binary file as a text in the existent window instead of the previous page. Ajax request is generated by <a4j:commandButton>. If I change a4j:commandButton to h:command all works fine, the browser opens up a saveas window.
      Is it possible to open up that saveas window in the case of the AJAX request either?

      P.S. In the action listener I get raw HttpServletResponse, set content to "application/octet-stream", write content to output stream and call FacesContext.getCurrentInstance().responseComplete(); at the enf of the listener.

      Many thanks in advance,
      Alexey