addressbuilder/src/main/java/org/ocpsoft/urlbuilder/util/Encoder.java
public static String path(CharSequence s) throws IllegalArgumentException
   {
      try
      {
         final URI uri = new URI("http", "0.0.0.0", "/" + s, null);
         return uri.toASCIIString().substring(15);
      }
      catch (URISyntaxException e)
      {
         throw new IllegalArgumentException(e);
      }
   }
public static String path(CharSequence s) throws IllegalArgumentException
   {
      try
      {
         final URI uri = new URI("http", "0.0.0.0", "/" + s, null);
         return uri.toASCIIString().substring(15);
      }
      catch (URISyntaxException e)
      {
         throw new IllegalArgumentException(e);
      }
   }
Encodes the given string using HTML form encoding as described in RFC 2396.

@throws IllegalArgumentException when illegal URI syntax is attempted.