code: 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);
        }
     }
docs: Encodes the given string using HTML form encoding as described in RFC 2396.
  
  @throws IllegalArgumentException when illegal URI syntax is attempted.