public class HttpRequest extends HttpBase<HttpRequest>
| 构造器和说明 |
|---|
HttpRequest(String url)
构造
|
| 限定符和类型 | 方法和说明 |
|---|---|
HttpRequest |
basicAuth(String username,
String password)
简单验证
|
HttpRequest |
body(byte[] content,
String contentType)
设置主体字节码
|
HttpRequest |
body(String body)
设置内容主体
|
static HttpRequest |
delete(String url)
DELETE请求
|
HttpResponse |
execute()
执行Reuqest请求
|
Map<String,Object> |
form()
获取表单数据
|
HttpRequest |
form(Map<String,Object> formMap)
设置map类型表单数据
|
HttpRequest |
form(String name,
Object value)
设置表单数据
|
HttpRequest |
form(String name,
Object value,
Object... parameters)
设置表单数据
|
static HttpRequest |
get(String url)
GET请求
|
static HttpRequest |
head(String url)
HEAD请求
|
HttpRequest |
method(Method method)
设置请求方法
|
static HttpRequest |
options(String url)
OPTIONS请求
|
static HttpRequest |
post(String url)
POST请求
|
static HttpRequest |
put(String url)
PUT请求
|
HttpRequest |
timeout(int milliseconds)
设置超时
|
static HttpRequest |
trace(String url)
TRACE请求
|
accept, accept, acceptEncoding, acceptEncoding, charset, charset, contentEncoding, contentLength, contentLength, contentType, contentType, contentType, header, header, header, header, header, header, header, headers, httpVersion, httpVersion, isKeepAlive, keepAlive, mediaType, mediaType, removeHeader, removeHeaderpublic HttpRequest(String url)
url - URLpublic HttpRequest method(Method method)
method - HTTP方法public static HttpRequest post(String url)
url - URLpublic static HttpRequest get(String url)
url - URLpublic static HttpRequest head(String url)
url - URLpublic static HttpRequest options(String url)
url - URLpublic static HttpRequest put(String url)
url - URLpublic static HttpRequest delete(String url)
url - URLpublic static HttpRequest trace(String url)
url - URLpublic HttpRequest form(String name, Object value)
name - 名value - 值public HttpRequest form(String name, Object value, Object... parameters)
name - 名value - 值parameters - 参数对,奇数为名,偶数为值public HttpRequest form(Map<String,Object> formMap)
formMap - public HttpRequest body(String body)
body - public HttpRequest body(byte[] content, String contentType)
content - contentType - public HttpRequest timeout(int milliseconds)
milliseconds - public HttpResponse execute()
public HttpRequest basicAuth(String username, String password)
username - 用户名password - 密码Copyright © 2015. All rights reserved.