In this example we will show ways to assemble a URI with groovy's URIBuilder. In a comparable example we demonstrate how to build a uri from a string in java, springframework and apache commons.
General operations
The general operations code snippet shows how to get the host, scheme, path, and port which are all common operations.
Get fragment
The fragment identifier is optional part at the end of a URI introduced with a hash mark #
and can be retreived with uri.gragment
.
Working with query parameters
The working with query parameters snippet shows how to get, remove, replace and add multiple query parameters.