A simple Java API to build URL strings with a fluid syntax and zero dependencies.
- fluid syntax
- query parameters automatically encoded with
URLEncode
andUTF8
- recognizes the following elements of URL spec: schema, authorization, host, port, path, query parameter, fragment
- supports parameter without value
- supports starting with a base URI
- supports returning an schema relative URL
String url = new UrlBuilder("http://foo.net")
.path("test")
.param("simpleParam", "1/2")
.param("multiValueParam", "first", "second")
.param("noValueParam")
.fragment("fragment")
.build();
returns:
http://foo.net/test?simpleParam=1%2F2&multiValueParam=first&multiValueParam=second&noValueParam#fragment