title: Perform page navigation after a file download
body: <p>I need to find a way to perform a page navigation after generating a file download. So far, I've got the file download ready and working:    </p>
  
  <pre><code>FileInputStream stream = new FileInputStream(file);
          FacesContext fc = FacesContext.getCurrentInstance();
          ExternalContext ec = fc.getExternalContext();
          ec.responseReset();
          ec.setResponseContentType("application/octet-stream");
          ec.setResponseHeader("Content-Disposition", "attachment; filename=\"" + fileName + "\"");
  
          OutputStream out = ec.getResponseOutputStream();
  
          byte[] outputByte = new byte[4096];
  
          while(stream.read(outputByte, 0, 4096) != -1)
          {
                  out.write(outputByte, 0, 4096);
          }
          stream.close();
          out.flush();
          out.close();
          fc.responseComplete();
  </code></pre>
  
  <p>So far, I've try redirecting from the ExternalContext afterwards but i get an IllegalStateException.</p>
  
  <pre><code>ec.redirect(url)
  </code></pre>
  
  <p>I've also tried wrapping all the previous code in a string method that returns the page to be navigated at the end. That didn't work either.</p>
  
  <p>Any recommendations?</p>