/** * Returns a String that is suitable for use as an {@code application/x-www-form-urlencoded} * list of parameters in an HTTP PUT or HTTP POST. * * @param parameters The parameters to include. * @param charset The encoding to use. * @return An {@code application/x-www-form-urlencoded} string */ public static String format( final List <? extends NameValuePair> parameters, final String charset) { return format(parameters, QP_SEP_A, charset); }
private String encodeUrlForm(final List<NameValuePair> params) { return URLEncodedUtilsHC4.format(params, Consts.UTF_8); }
/** * Returns a String that is suitable for use as an {@code application/x-www-form-urlencoded} * list of parameters in an HTTP PUT or HTTP POST. * * @param parameters The parameters to include. * @param charset The encoding to use. * @return An {@code application/x-www-form-urlencoded} string * * @since 4.2 */ public static String format( final Iterable<? extends NameValuePair> parameters, final Charset charset) { return format(parameters, QP_SEP_A, charset); }
/** * Constructs a new {@link UrlEncodedFormEntity} with the list * of parameters in the specified encoding. * * @param parameters iterable collection of name/value pairs * @param charset encoding the name/value pairs be encoded with * * @since 4.2 */ public UrlEncodedFormEntityHC4 ( final Iterable <? extends NameValuePair> parameters, final Charset charset) { super(URLEncodedUtilsHC4.format(parameters, charset != null ? charset : Charset.forName(HTTP.DEFAULT_CONTENT_CHARSET)), ContentType.create(URLEncodedUtilsHC4.CONTENT_TYPE, charset)); }
/** * Constructs a new {@link UrlEncodedFormEntity} with the list * of parameters in the specified encoding. * * @param parameters list of name/value pairs * @param charset encoding the name/value pairs be encoded with * @throws UnsupportedEncodingException if the encoding isn't supported */ public UrlEncodedFormEntityHC4 ( final List <? extends NameValuePair> parameters, final String charset) throws UnsupportedEncodingException { super(URLEncodedUtilsHC4.format(parameters, charset != null ? charset : Charset.forName(HTTP.DEFAULT_CONTENT_CHARSET).name()), ContentType.create(URLEncodedUtilsHC4.CONTENT_TYPE, charset)); }