What is it

urlparameters provides the logic needed to read and write "URL parameters."

This covers both query parameters, often seen at the end of a URL (, and the bodies of html form submissions (name=bob&age=98).

It uses com.uwyn.urlencoder to properly encode parameters for both situations.

Why use it

Most websites eventually encode some information as query parameters inside a URL. urlparameters lets you extract that information as well as produce such URLs.

It is also common for websites to accept information from a user via a form submission - more so if you server-side render HTML. Processing those form submissions means parsing those request bodies.

Getting Started

Parse Query Params from a URL


import dev.mccue.urlparameters.UrlParameters;

void main() {
   var url = URI.create("");
   var params = UrlParameters.parse(url);

(Playground Link)

Parse Form Submission bodies

import dev.mccue.urlparameters.UrlParameters;

void main() {
   var body = "name=jack&title=squire";
   var params = UrlParameters.parse(body);
   // squire

Generate a URL with Query Params

import java.util.List;

import dev.mccue.urlparameters.UrlParameters;
import dev.mccue.urlparameters.UrlParameter;

void main() {
   var params = new UrlParameters(List.of(
       new UrlParameter("pokemon", "stantler"),
       new UrlParameter("caught_in", "Pokemon Colosseum")
   var url = URI.create("" + params);

<- Index