URL checker

This webapp contains only one servlet which checks the status codes returned by configured URLs.
Both valid status codes and checked URLs have default values (see web.xml file) which can be overriden in the context file as init parameters at deploy time.
Additionally, the optional URL parameters url and status override at request time any of the previously configured values.
Note about the URL values: localhost refers to the host running this web application.

The response

The servlet returns a plain text response, whose status code is:

  • 200 (OK) if all of the checked URL return a valid status code
  • 500 (internal server error) if any of the checked URLs does not return a valid status code

The text returned is simply a list of codes returned by each URL, with a [+] if the checker is happy with the returned code, [-] otherwise.


This application requires a filter in the classpath - most conveniently put in the ${catalina.base}/lib directory - which will tag all requests to the servlet as health check, which allows to disable logging of the requests if the proper AccessLogValve is configured for the server.
Of course, if you don't want the checked URLs to appear in the access log you should also configure the same filter for the corresponding webapps.


A load balancer can check the availability of URLs. In our case, we had a limitation: the load balancer could only check one for the single tomcat server running more than one application. We needed this application to give its URL to the load balancer and check in one go more than one URL for each application.