public class HttpRequest extends HttpBase<HttpRequest>
| 限定符和类型 | 字段和说明 |
|---|---|
protected String |
method
method
|
body, charset, DEFAULT_BUFFER_SIZE, form, formEncoding, HEADER_ACCEPT, HEADER_ACCEPT_ENCODING, HEADER_CLOSE, HEADER_CONNECTION, HEADER_CONTENT_ENCODING, HEADER_CONTENT_LENGTH, HEADER_CONTENT_TYPE, HEADER_ETAG, HEADER_HOST, HEADER_KEEP_ALIVE, HEADER_USER_AGENT, headers, HTTP_1_0, HTTP_1_1, httpVersion, mediaType| 构造器和说明 |
|---|
HttpRequest(String url)
设置请求URL
|
| 限定符和类型 | 方法和说明 |
|---|---|
HttpResponse |
execute()
执行Reuqest请求
|
static HttpRequest |
get(String url)
GET请求
|
static HttpRequest |
post(String url)
POST请求
|
HttpRequest |
timeout(int milliseconds)
设置超时
|
accept, accept, acceptEncoding, acceptEncoding, body, body, body, bodyBytes, bodyHtml, bodyText, bodyText, bodyText, bodyText, charset, charset, close, connectionKeepAlive, contentEncoding, contentLength, contentLength, contentType, contentType, contentType, copy, copyLarge, copyLarge, form, formEncoding, header, header, header, header, header, headers, httpVersion, httpVersion, initForm, isConnectionPersistent, mediaType, mediaType, query, query, query, query, readBody, removeHeader, wrapFormValueprotected String method
public HttpRequest(String url)
url - public static HttpRequest post(String url)
url - public static HttpRequest get(String url)
url - public HttpRequest timeout(int milliseconds)
milliseconds - public HttpResponse execute() throws Exception
IOExceptionNoSuchProviderExceptionNoSuchAlgorithmExceptionKeyManagementExceptionExceptionCopyright © 2015. All rights reserved.