code: public String toQueryString() {
  
          String result = null;
  
          List<String> parameters = new ArrayList<>();
          for (Map.Entry<String, String> entry : entrySet()) {
              // We don't encode the key because it could legitimately contain
              // things like underscores, e.g. "_escaped_fragment_" would become:
              // "%5Fescaped%5Ffragment%5F"
              String key = entry.getKey();
              String value;
              try {
                  value = URLEncoder.encode(entry.getValue(), StandardCharsets.UTF_8.name());
              } catch (UnsupportedEncodingException e) {
                  throw new IllegalArgumentException("Error encoding URL", e);
              }
              // Jetty class *appears* to need Java 8
              //String value = UrlEncoded.encodeString(entry.getValue());
              parameters.add(key + "=" + value);
          }
          if (parameters.size() > 0) {
              result = StringUtils.join(parameters, '&');
          }
  
          return result;
      }
docs: A value suitable for constructinng URIs with. This means that if there
  are no parameters, null will be returned.
  
  @return If the map is empty, null, otherwise an escaped query string.