Urin is a URI generator and parser for Java. It is written to make the dynamic generation of URIs easier than it is with Java's built-in URI and URL classes, and to provide support for the current URI standard, RFC 3986. It is open source, and free for you to use.

The latest version of Urin available for download is 2.21. The javadoc is also available online.


A brief example demonstrates the generation of an HTTP URI:

import static net.sourceforge.urin.Host.*; import static net.sourceforge.urin.Path.*; import static net.sourceforge.urin.scheme.http.Http.*; ... http( registeredName(""), path("music", "AC/DC", "Back in Black") ).asString();

This produces the String "". Note that the '/' character in "AC/DC" has been encoded as "%2F", and that the space characters in "Back in Black" have been encoded as "%20".

In the above example, the registered name and path could be any Java Strings we choose; the library will encode them appropriately to the part of the URI where they appear.

It's equally easy to go back to the non-encoded version:

import static net.sourceforge.urin.scheme.http.Http.*; ... parseHttpUrin( "" ).path().segments();

This produces a List of three Segments, with the values "music", "AC/DC", and "Back in Black".