Skip to content

Utility class for constructing syntactically correct HTTP URLs using a fluent method-chaining API. It strives simply to be more robust then manually constructing URLs by string concatenation.

Notifications You must be signed in to change notification settings

uriahcarpenter/urlbuilder

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

UrlBuilder

Utility class for constructing syntactically correct HTTP URLs using a fluent method-chaining API. It strives simply to be more robust then manually constructing URLs by string concatenation.

new UrlBuilder("my.host.com", "foo").addPathSegment("bar").addParameter("a", "b").toString()

produces http://my.host.com/foo/bar?a=b

Features

  • Automatic slash management in paths. Slashes will be deduped or added as necessary when using addPathSegment
  • Automatic URL encoding for both path segments (preserving slashes) and query parameters
  • '+'s in URL encoded values are replaced with '%20's
  • Options for generation of fully-qualified, hostname relative, or protocol relative URLs
  • Fluent method-chaining API

More examples at https://github.com/Widen/urlbuilder/blob/master/test/com/widen/util/UrlBuilderTest.java

Version 0.9 - Initial release Version 0.9.1 - Add S3UrlBuilder

Licensed under Apache, Version 2.0.

About

Utility class for constructing syntactically correct HTTP URLs using a fluent method-chaining API. It strives simply to be more robust then manually constructing URLs by string concatenation.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published