Given that in my daily work routine I browse several huge documentation libraries, I have two problems:
  1. sometimes I do not have any network access and thus I cannot access anything online, thus no documentation [sic...]
  2. if I store everything locally, it takes up way too much space (JDKs, ATG, Oracle, etc.)
It would be wonderful if I could compress the data to a zip archive and have transparent or near-transparent access. Indeed, there are Java IDEs that can do that... For example, IntelliJ IDEA and NetBeans can access the Javadocs HTML pages on a ZIP archive. A different solution is the Apache module built for this purpose, mod_ziplook2, that allows to treat ZIP files as directories, and it was what I was using on the old laptop. On the new one, I never managed to properly compile the Cygwin Apache 2 package, and the 1.3 Apache hangs completely after 5/6 requests... It doesn't seem very much up-to-date however, and my days as a C hacker are long gone.

So I decided to write a mod_ziplook equivalent as a Java servlet, using the excellent TrueZIP library: returning an HTML page to a browser is extremely simple, for example http://localhost/docs/jdk-142-docs.zip/jdk-142-docs/api/java/lang/String.html resolves to this handleFile() method where all the "real" work is done by the catTo() call:
private void handleFile (de.schlichtherle.io.File pFileEntry,
                         HttpServletRequest pReq,
                         HttpServletResponse pRes) throws IOException {  
  // get the content type of the file to be transmitted
  String mimeType = getServletContext().getMimeType(pFileEntry.getName());
  
  // get the size of the uncompressed data
  long fileSize = pFileEntry.length();
  
  // write the response headers
  pRes.setContentType(mimeType);
  pRes.setContentLength((int)fileSize);
  
  // write the response data
  pFileEntry.catTo(pRes.getOutputStream());
}
Download the result and deploy the dist/zipdocs.war archive to your favorite container. I'm currently using the Sun Java System Web Server and it works just dandy :-).

A name, valid email address and comment text are required. The email address will be saved but will never be displayed.




A subset of Textile formatting is supported thanks to textile4j.
Quick block modifiers:
Header: hn.
Blockquote: bq.
Numeric list: #
Bulleted list: *

To insert a link: "linktext":url
To write a code example: <code>...</code>
To define an acronym: ABC(Always Be Closing)

Quick phrase modifiers:
_emphasis_    *strong*
??citation??    -deleted text-
+inserted text+    ^superscript^
~subscript~