Java Projects

Java Libraries

Expression Evaluator

A library to parse and evaluate mathematical expressions, including the ability to call functions implemented (by you) in Java.

Updated 2008-06-20: released under the GNU Lesser General Public License (LGPL).
Updated 2009-04-09: fixed parser bug which allowed trailing junk in the expression to be ignored. Also updated to junit 4.5.

Get the binary and source (1.3MiB zip or 850KiB tar.gz - includes source, javadoc, pre-built JAR, and dependent libraries - ANTLR, jmock and junit).
See the Javadoc.

zipcodes

A Java library (and data files) for looking up US postal codes and performing distance operations on them. (Updated 2007-04-25: latitude and longitude were being read from the data file inverted).

Get the java source code (722KiB - includes source, javadoc, and pre-built JAR).
See the Javadoc.

TestURLConnection

A Java library that allows developers to easily test code that uses Java's java.net.URL class to access resources. It provides a URL protocol that will return object that the developer can control by implementing an interface.

You can find everything on SourceForge.net under the TestURLConnection project.

Emailer

A Java library that wraps the JavaMail API. This library makes it easier to do things like create MIME messages containing attachments, text and HTML bodies, and embedded resources for HTML bodies.

Note that this library has not yet undergone extensive testing. YMMV.

Get the java source code (675KiB - includes source, javadoc, and pre-built JAR).
See the javadoc.

Java Toys

URLFetch

Essentially a Java version of 'wget'.

You can get the full source code in a single .java file.

JSP Utilities

SessionSnooper

SessionSnooper allows you to browse request headers and request-, session-, and application-scoped attributes.

It requires that you also have htmlescape.jsp, httpheaderreferences.jsp, and util.jsp in the same directory so they can be included.

Once you have the include files mentioned above, you can simply copy the JSP file into your webapp and start using it. I recommend limiting access to it, since it can display a lot of information about your running application.

RequestDumper

Similar to the SessionSnooper, RequestDumper allows you to browse request headers, parameters, and attributes.

For debugging purposes, you could put it at the end of a request forwarding chain to verify your assumptions about the state of the request at the end of processing.

It requires that you also have htmlescape.jsp, httpheaderreferences.jsp, and util.jsp in the same directory so they can be included.

Once you have the include files mentioned above, you can simply copy the JSP file into your webapp and start using it. I recommend limiting access to it, since it can display a lot of information about your running application.

AdHocQuery

Allows users to submit ad-hoc SQL queries to their database and display the results in HTML form.

It requires that you also have htmlescape.jsp in the same directory so it can be included.

Once you have the include file mentioned above, you can copy the JSP file into your webapp. You will have to modify the getConnection method to suit your needs. I highly recommend limiting access to it, since it gives users access your database (!) and they can even run queries that can really lock up your machine. I also recommend using a JDBC connection pool whose connections are configured to only allow SELECT queries, so that information cannot be modified using this JSP.

log4j configurator

Allows you to modify your log4j configuration while your server is running. Change logger or appander settings, as well as test the logger right from a web page.

Logger and appender JSP files are included in this archive.

Other Useful Tidbits

securityfilter DataSourceRealm

A Realm for SecurityFilter that uses a JNDI DataSource for it's authentication information.

You will need to provide your own implementation of the "Digester" class whose use is fairly obvious from the code available here.

There are two source files:

  1. DataSourceRealm.java
  2. SimplePrincipal.java (a java.security.Principal implementation used by DataSourceRealm)