1. 程式人生 > >HttpClient` 原始碼詳解之`UrlEncodedFormEntity

HttpClient` 原始碼詳解之`UrlEncodedFormEntity

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