Java Servlet GWebCache Application

This is an implementation of the GWebCache protocol as a Java web application. The code was developed using Apache Tomcat versions 4.0.3, 4.1.24 (MacOS X) and 5.0.28 (Linux and FreeBSD), I do not know yet if it works on any other servlet container.

To install, copy the war file to the webapps folder of the servlet container, it will be unpacked automatically upon server start or on first request, depending upon configuration. Alternatively with Apache Tomcat you can deploy using the HTML Manager application, simply select the downloaded GWebCache.war file for the option "Upload a WAR file to install" and press the "install" button. To make the cache more efficient, turn off cookie support for GWebCache.war, it is not needed and just overhead. With Apache Tomcat, login using the admin application and turn off cookie support under "Tomcat Server/Service/Host/Context /GWebCache".

I have seen a problem where all URL's in the cache appear to get stuck in the QUEUED state. Doing tracebacks at that point shows that the Java standard HTTP client library is blocked reading data from a client. This can be worked around by specifying a default read time out. As far as I know that must be set as the system property. With Tomcat I did put that in the CATALINA_OPTS environment variable like this (for a 60s timeout):

CATALINA_OPTS="-Dsun.net.client.defaultReadTimeout=60000"

Unless you specify a different name, the web app will be installed as /GWebCache in the servlet container. Accessing this menu gives a minimal info page and a link to a data dump and and a link to statistics of the cache. The path to the servlet itself (used by the clients) is /GWebCache/req, but accessing this URL without CGI parameters redirects back to the info page.


Download the GWebCache.war file
Link to the github repository
Jens-Uwe Mager