title: integrate Bootstrap's progress bar in reactjs - invoking java servlet API call from superagent
body: <p>I have a requirement that, i have to generate a Excel report and have to download the same from the react js application. I do want to integrate Bootstrap's progress bar while doing this process. </p>
  
  <p>How i can integrate progress bar here.?</p>
  
  <p>Please find my code below.</p>
  
  <p>BootStrap Progress bar code:</p>
  
  <pre><code>&lt;div class="progress"&gt;
        &lt;div class="progress-bar" role="progressbar" aria-valuenow="" aria-
        valuemin="0" aria-valuemax="100" style="width: 60%;"&gt;
        &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>ReactJS (SuperAgent) code for generating Excel sheet and download the same.</p>
  
  <pre><code>handleInvoice(e)
   {
      e.preventDefault()
      var item = this.state.item;
      var lines = item.order;
      var request = require('superagent');
      var apiBaseUrl = "api/Invoice";
      var req = request.get(apiBaseUrl);
      req.query({ item : item.id})
      req.end(function(err,res){
           if(err){
               alert(" error"+err);
               confirmAlert({
                      message: 'Invoice is not prepared properly.....', 
                      confirmLabel: 'Ok', 
                  });
            }
           else{
                  window.location= 'api/Invoice?item=' + item.id,'';
                  element.click();
              } 
  
          });
  }
  </code></pre>
  
  <p>ReactJS Botton code to invoke handleInvoice() method :</p>
  
  <pre><code>return ( &lt;button type="submit" className="btn btn-primary"  onClick={ 
           this.handleInvoice } &gt; Invoice &lt;/button&gt; );
  </code></pre>
  
  <p>Please find my servlet code :</p>
  
  <pre><code>try {
          String reportname = "Invoice";  
          resp.setContentType("application/vnd.ms-excel");
          resp.setHeader("Content-Disposition", "attachment; filename=" + 
          reportname + ".xls");
          HSSFWorkbook workbook1=service.getCommercialInvoiceService(id);
          ByteArrayOutputStream outByteStream = new ByteArrayOutputStream();
          workbook1.write(outByteStream);
              byte [] outArray = outByteStream.toByteArray();
              int fileSize=outArray.length;
              outStream = resp.getOutputStream();
              outStream.write(outArray);
              outStream.flush();
              outStream.close();
              resp.setHeader("Content-Length", ""+fileSize);
              System.out.println("File Size"+fileSize);
  
      } catch (IOException ioe) {
          throw new ServletException(ioe);
          }
  </code></pre>
  
  <p>Please find my servlet code., where am getting the size of the file and am setting it to the response header also.</p>