public abstract class HttpResponse
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
protected HttpClientConfiguration |
CONF |
protected java.io.InputStream |
is |
private JSONObject |
json |
private JSONArray |
jsonArray |
private static Logger |
logger |
protected java.lang.String |
responseAsString |
protected int |
statusCode |
private boolean |
streamConsumed |
| Constructor and Description |
|---|
HttpResponse() |
HttpResponse(HttpClientConfiguration conf) |
| Modifier and Type | Method and Description |
|---|---|
JSONArray |
asJSONArray()
Returns the response body as twitter4j.JSONArray.
Disconnects the internal HttpURLConnection silently. |
JSONObject |
asJSONObject()
Returns the response body as twitter4j.JSONObject.
Disconnects the internal HttpURLConnection silently. |
java.io.Reader |
asReader() |
java.io.InputStream |
asStream()
Returns the response stream.
This method cannot be called after calling asString() or asDcoument() It is suggested to call disconnect() after consuming the stream. |
java.lang.String |
asString()
Returns the response body as string.
Disconnects the internal HttpURLConnection silently. |
abstract void |
disconnect() |
private void |
disconnectForcibly() |
abstract java.lang.String |
getResponseHeader(java.lang.String name) |
abstract java.util.Map<java.lang.String,java.util.List<java.lang.String>> |
getResponseHeaderFields() |
int |
getStatusCode() |
java.lang.String |
toString() |
private static final Logger logger
protected final HttpClientConfiguration CONF
protected int statusCode
protected java.lang.String responseAsString
protected java.io.InputStream is
private boolean streamConsumed
private JSONObject json
private JSONArray jsonArray
HttpResponse()
public HttpResponse(HttpClientConfiguration conf)
public int getStatusCode()
public abstract java.lang.String getResponseHeader(java.lang.String name)
public abstract java.util.Map<java.lang.String,java.util.List<java.lang.String>> getResponseHeaderFields()
public java.io.InputStream asStream()
TwitterExceptiondisconnect()public java.lang.String asString()
throws TwitterException
TwitterExceptionpublic JSONObject asJSONObject() throws TwitterException
TwitterExceptionpublic JSONArray asJSONArray() throws TwitterException
TwitterExceptionpublic java.io.Reader asReader()
private void disconnectForcibly()
public abstract void disconnect()
throws java.io.IOException
java.io.IOExceptionpublic java.lang.String toString()
toString in class java.lang.Object