|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectcom.loopj.android.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);
| Field Summary | |
|---|---|
protected ConcurrentHashMap<String,com.loopj.android.http.RequestParams.FileWrapper> |
fileParams
|
protected ConcurrentHashMap<String,String> |
urlParams
|
| Constructor Summary | |
|---|---|
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(String key,
String value)
Constructs a new RequestParams instance and populate it with a single initial key/value string param. |
|
| Method Summary | |
|---|---|
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()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected ConcurrentHashMap<String,String> urlParams
protected ConcurrentHashMap<String,com.loopj.android.http.RequestParams.FileWrapper> fileParams
| Constructor Detail |
|---|
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.| Method Detail |
|---|
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,
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()
toString in class Object
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||