facebook4j.internal.http
Class HttpResponse

java.lang.Object
  extended by facebook4j.internal.http.HttpResponse
Direct Known Subclasses:
HttpResponseImpl

public abstract class HttpResponse
extends java.lang.Object

A data class representing HTTP Response

Author:
Yusuke Yamamoto - yusuke at mac.com

Field Summary
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 Summary
HttpResponse()
           
HttpResponse(HttpClientConfiguration conf)
           
 
Method Summary
 JSONArray asJSONArray()
          Returns the response body as facebook4j.internal.org.json.JSONArray.
Disconnects the internal HttpURLConnection silently.
 JSONObject asJSONObject()
          Returns the response body as facebook4j.internal.org.json.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()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

logger

private static final Logger logger

CONF

protected final HttpClientConfiguration CONF

statusCode

protected int statusCode

responseAsString

protected java.lang.String responseAsString

is

protected java.io.InputStream is

streamConsumed

private boolean streamConsumed

json

private JSONObject json

jsonArray

private JSONArray jsonArray
Constructor Detail

HttpResponse

HttpResponse()

HttpResponse

public HttpResponse(HttpClientConfiguration conf)
Method Detail

getStatusCode

public int getStatusCode()

getResponseHeader

public abstract java.lang.String getResponseHeader(java.lang.String name)

getResponseHeaderFields

public abstract java.util.Map<java.lang.String,java.util.List<java.lang.String>> getResponseHeaderFields()

asStream

public 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.

Disconnects the internal HttpURLConnection silently.

Returns:
response body stream
Throws:
FacebookException
See Also:
disconnect()

asString

public java.lang.String asString()
                          throws FacebookException
Returns the response body as string.
Disconnects the internal HttpURLConnection silently.

Returns:
response body
Throws:
FacebookException

asJSONObject

public JSONObject asJSONObject()
                        throws FacebookException
Returns the response body as facebook4j.internal.org.json.JSONObject.
Disconnects the internal HttpURLConnection silently.

Returns:
response body as facebook4j.internal.org.json.JSONObject
Throws:
FacebookException

asJSONArray

public JSONArray asJSONArray()
                      throws FacebookException
Returns the response body as facebook4j.internal.org.json.JSONArray.
Disconnects the internal HttpURLConnection silently.

Returns:
response body as facebook4j.internal.org.json.JSONArray
Throws:
FacebookException

asReader

public java.io.Reader asReader()

disconnectForcibly

private void disconnectForcibly()

disconnect

public abstract void disconnect()
                         throws java.io.IOException
Throws:
java.io.IOException

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object