title: Java 11: New HTTP client send POST requests with x-www-form-urlencoded parameters
body: <p>I'm trying to send a POST request using the new http client api.
  Is there a built in way to send parameters formatted as <code>x-www-form-urlencoded</code> ?</p>
  
  <p>My current code:</p>
  
  <pre><code>HttpRequest request = HttpRequest.newBuilder()
          .uri(URI.create(url))
          .header("Content-Type", "application/x-www-form-urlencoded")
          .POST(BodyPublishers.ofString("a=get_account&amp;account=" + URLEncoder.encode(account, "UTF-8")))
          .build();
  </code></pre>
  
  <p>What I'm looking is for a better way to pass the parameters. Something like this:</p>
  
  <pre><code>Params p=new Params();
  p.add("a","get_account");
  p.add("account",account);
  </code></pre>
  
  <p>Do I need to build myself this functionality or is something already built in?</p>
  
  <p>I'm using Java 12.</p>