public abstract class NetworkRequest<Return>
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
protected static interface |
NetworkRequest.BodyLoader |
protected static class |
NetworkRequest.InputStreamBodyLoader |
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
ACCEPT |
static java.lang.String |
CONTENT_TYPE |
| Constructor and Description |
|---|
NetworkRequest(java.lang.String url) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
cancel() |
protected void |
disconnect() |
Return |
execute() |
java.net.HttpURLConnection |
getConnection() |
int |
getResponseCode() |
boolean |
isCancelable() |
boolean |
isCanceled() |
boolean |
isExecuted() |
protected abstract Return |
parseResponse(java.io.InputStream stream)
Implementations must call
disconnect() after they are done with the connection. |
void |
resetRequest() |
void |
setBody(java.io.File file) |
void |
setBody(java.io.InputStream stream) |
void |
setBody(org.json.JSONArray body) |
void |
setBody(org.json.JSONObject body) |
void |
setBody(NetworkRequest.BodyLoader bodyLoader) |
void |
setBody(java.lang.String body) |
boolean |
setMethod(java.lang.String method) |
static java.lang.String |
toString(java.io.InputStream input,
java.lang.String charsetName) |
public static final java.lang.String CONTENT_TYPE
public static final java.lang.String ACCEPT
public NetworkRequest(java.lang.String url)
throws java.io.IOException
java.io.IOExceptionpublic void resetRequest()
throws java.io.IOException
java.io.IOExceptionpublic java.net.HttpURLConnection getConnection()
public boolean setMethod(java.lang.String method)
public void setBody(java.lang.String body)
public void setBody(org.json.JSONObject body)
public void setBody(org.json.JSONArray body)
public void setBody(java.io.InputStream stream)
public void setBody(java.io.File file)
public void setBody(NetworkRequest.BodyLoader bodyLoader)
public Return execute() throws java.io.IOException
java.io.IOExceptionprotected abstract Return parseResponse(java.io.InputStream stream) throws java.io.IOException
disconnect() after they are done with the connection.stream - java.io.IOExceptionprotected void disconnect()
public boolean isCancelable()
public boolean cancel()
public boolean isCanceled()
public boolean isExecuted()
public int getResponseCode()
public static java.lang.String toString(java.io.InputStream input,
java.lang.String charsetName)
throws java.io.IOException
java.io.IOException