HttpClient` 源码详解之`UrlEncodedFormEntity

版权声明:如若转载,请联系作者。 https://blog.csdn.net/liu16659/article/details/84401652

HttpClient 源码详解之UrlEncodedFormEntity

1. 类释义

/**
 * An entity composed of a list of url-encoded pairs.
 * This is typically useful while sending an HTTP POST request.
 *
 * @since 4.0
 */

由url编码对的列表组成的实体。当发送一个HTTP POST 请求时,这个就非常有用了。

2. 方法

  • 构造器
/**
     * Constructs a new {@link UrlEncodedFormEntity} with the list
     * of parameters with the default encoding of {@link HTTP#DEFAULT_CONTENT_CHARSET}
     *
     * @param parameters list of name/value pairs
     * @throws UnsupportedEncodingException if the default encoding isn't supported
     */
    public UrlEncodedFormEntity (
        final List <? extends NameValuePair> parameters) throws UnsupportedEncodingException {
        this(parameters, (Charset) null);
    }

使用参数列表以及默认的编码器构造一个 UrlEncodedFormEntity

猜你喜欢

转载自blog.csdn.net/liu16659/article/details/84401652