|
||||||||||
上一个类 下一个类 | 框架 无框架 | |||||||||
摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 |
java.lang.Objectcom.baidu.sapi2.http.RequestParams
public class RequestParams
A collection of string request parameters or files to send along with
requests made from an AsyncHttpClient
instance.
For example:
RequestParams params = new RequestParams(); params.put("username", "james"); params.put("password", "123456"); params.put("email", "my@email.com"); params.put("profile_picture", new File("pic.jpg")); // Upload a File params.put("profile_picture2", someInputStream); // Upload an InputStream params.put("profile_picture3", new ByteArrayInputStream(someBytes)); // Upload // some // bytes AsyncHttpClient client = new AsyncHttpClient(); client.post("http://myendpoint.com", params, responseHandler);
字段摘要 | |
---|---|
protected ConcurrentHashMap<String,com.baidu.sapi2.http.RequestParams.FileWrapper> |
fileParams
|
protected ConcurrentHashMap<String,String> |
urlParams
|
protected ConcurrentHashMap<String,ArrayList<String>> |
urlParamsWithArray
|
构造方法摘要 | |
---|---|
RequestParams()
Constructs a new empty RequestParams instance. |
|
RequestParams(Map<String,String> source)
Constructs a new RequestParams instance containing the key/value string params from the specified map. |
|
RequestParams(Object... keysAndValues)
Constructs a new RequestParams instance and populate it with multiple initial key/value string param. |
|
RequestParams(String key,
String value)
Constructs a new RequestParams instance and populate it with a single initial key/value string param. |
方法摘要 | |
---|---|
org.apache.http.HttpEntity |
getEntity()
Returns an HttpEntity containing all request parameters |
protected List<org.apache.http.message.BasicNameValuePair> |
getParamsList()
|
protected String |
getParamString()
|
void |
put(String key,
ArrayList<String> values)
Adds param with more than one value. |
void |
put(String key,
File file)
Adds a file to the request. |
void |
put(String key,
InputStream stream)
Adds an input stream to the request. |
void |
put(String key,
InputStream stream,
String fileName)
Adds an input stream to the request. |
void |
put(String key,
InputStream stream,
String fileName,
String contentType)
Adds an input stream to the request. |
void |
put(String key,
String value)
Adds a key/value string pair to the request. |
void |
remove(String key)
Removes a parameter from the request. |
String |
toString()
|
从类 java.lang.Object 继承的方法 |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
字段详细信息 |
---|
protected ConcurrentHashMap<String,String> urlParams
protected ConcurrentHashMap<String,com.baidu.sapi2.http.RequestParams.FileWrapper> fileParams
protected ConcurrentHashMap<String,ArrayList<String>> urlParamsWithArray
构造方法详细信息 |
---|
public RequestParams()
RequestParams
instance.
public RequestParams(Map<String,String> source)
source
- the source key/value string map to add.public RequestParams(String key, String value)
key
- the key name for the intial param.value
- the value string for the initial param.public RequestParams(Object... keysAndValues)
keysAndValues
- a sequence of keys and values. Objects are
automatically converted to Strings (including the value
null
).
IllegalArgumentException
- if the number of arguments isn't even.方法详细信息 |
---|
public void put(String key, String value)
key
- the key name for the new param.value
- the value string for the new param.public void put(String key, File file) throws FileNotFoundException
key
- the key name for the new param.file
- the file to add.
FileNotFoundException
public void put(String key, ArrayList<String> values)
key
- the key name for the new param.values
- is the ArrayList with values for the param.public void put(String key, InputStream stream)
key
- the key name for the new param.stream
- the input stream to add.public void put(String key, InputStream stream, String fileName)
key
- the key name for the new param.stream
- the input stream to add.fileName
- the name of the file.public void put(String key, InputStream stream, String fileName, String contentType)
key
- the key name for the new param.stream
- the input stream to add.fileName
- the name of the file.contentType
- the content type of the file, eg. application/jsonpublic void remove(String key)
key
- the key name for the parameter to remove.public String toString()
Object
中的 toString
public org.apache.http.HttpEntity getEntity()
protected List<org.apache.http.message.BasicNameValuePair> getParamsList()
protected String getParamString()
|
||||||||||
上一个类 下一个类 | 框架 无框架 | |||||||||
摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 |