private static String urlPair(Object name, Object val, boolean urlEncode) {
    if (val != null) {
      return name
      + "="
      + ((urlEncode && val instanceof String) ? UrlUtil.urlEncode(val
          .toString()) : val);
    } else {
      return null;
    }
  }