title: When processing HAR file need to get entries for one page at a time
body: <p>I am trying to get the total load time for each page by parsing a HAR file.  I found a code segment where the total time is found by subtracting the time of the last get from the start of the page.  So far so good.</p>
  
  <p>I have an outer loop that goes through all the pages.</p>
  
  <pre><code>      List&lt;HarPage&gt; pages = log.getPages().getPages();
          for (HarPage page : pages)
          {
          / confirms that I go through all the pages
          writer.println("\n\n***\n    Top of page loop, Page Number   :" + pageNumber);
          }
  
  
  
  /* The problem is that I would like to process all the entries for one page  at a time.  This inner loop is not working properly and seems to go through  the entries for all the pages.  The calling sequence is as follows:
  */    
      List&lt;HarPage&gt; pages = log.getPages().getPages();
      for (HarPage page : pages)
      {
                          HarEntries entries = log.getEntries();
                          List&lt;HarEntry&gt; entryList = entries.getEntries();
                          int entryIndex = 0;
                          for (HarEntry entry : entryList) {
                          / print entry number to see how many entries it processes
                          writer.println("Page Number: " + pageNumber + "  Entry: " + entryIndex++);
                          entryIndex++;
                          }
      }
  </code></pre>
  
  <p>I have 124 entries in the first page (which I confirmed by processing the file through <a href="http://www.softwareishard.com/har/viewer/" rel="nofollow">http://www.softwareishard.com/har/viewer/</a> but my program will go through 1305 entries for all pages.</p>
  
  <p>Thanks,
  Tariq Badsha</p>
  
  <p>PS I found out that there is a field in the Entry entry.getPageRef().  This changes when I go to the next page.  So maybe this can be used as a trigger to exit from the inner loop.  If someone has a more elegant solution Please comment
  TB</p>