title: Reading files and directories within compressed war archive
body: <p>I'm trying to access a folder inside a compressed war archive but with no success.</p>
  
  <p>Archive structure:</p>
  
  <pre><code>app.war                
         |- META-INF       
         |- org               
         |- WEB-INF             
                     |- classes 
                                |- com       
                                |- static    
                                |- testcases      
                                            |- 1          
                                            |- 2...       
                                            |- ...22      
                                                     |- README.txt (file)
                                                     |- TEST.CASE  (file)
  </code></pre>
  
  <p>This is my code for reading the contents of the directory <strong>testcases</strong>:</p>
  
  <pre><code>URL url = Thread.currentThread().getClass().getClassLoader().getResource("testcases");
  
  LOG.debug("PROTOCOL=" + url.getProtocol());   
  
  List&lt;String&gt; files = IOUtils.readLines(url.openStream());
  
  LOG.debug("DIRS=" + files.size());
  LOG.debug("PATH=" + url.getPath());
  for (String s : files)
      LOG.debug(s);
  </code></pre>
  
  <p>Running in eclipse the output I get is:</p>
  
  <pre><code>TestCaseUtil : PROTOCOL=file
  TestCaseUtil : DIRS=22
  TestCaseUtil : PATH=/C:/Users/{Name}/development/git/app/target/classes/testcases    
  TestCaseUtil : 1    
  ...             
  TestCaseUtil : 22
  </code></pre>
  
  <p>When I execute the war from command line with <code>java -jar app.war</code> I get the following output:</p>
  
  <pre><code>TestCaseUtil : PROTOCOL=jar
  TestCaseUtil : DIRS=0
  TestCaseUtil : PATH=file:/C:/Users/{Name}/development/git/app/target/app.war!/WEB-INF/classes!/testcases
  </code></pre>
  
  <p>Can someone tell me what I'm doing wrong?</p>