com.qq.connect.utils.http
类 Response

java.lang.Object
  继承者 com.qq.connect.utils.http.Response

public class Response
extends java.lang.Object

A data class representing HTTP Response


构造方法摘要
Response()
           
Response(java.net.HttpURLConnection con)
           
 
方法摘要
 org.w3c.dom.Document asDocument()
          Returns the response body as org.w3c.dom.Document.
 JSONArray asJSONArray()
          Returns the response body as sinat4j.org.json.JSONArray.
 JSONObject asJSONObject()
          Returns the response body as sinat4j.org.json.JSONObject.
 java.io.InputStreamReader asReader()
           
 java.io.InputStream asStream()
          Returns the response stream.
 java.lang.String asString()
          Returns the response body as string.
 void disconnect()
           
 java.lang.String getResponseAsString()
           
 java.lang.String getResponseHeader(java.lang.String name)
           
 int getStatusCode()
           
 void setResponseAsString(java.lang.String responseAsString)
           
 void setStatusCode(int statusCode)
           
 java.lang.String toString()
           
static java.lang.String unescape(java.lang.String original)
          Unescape UTF-8 escaped characters to string.
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

构造方法详细信息

Response

public Response()

Response

public Response(java.net.HttpURLConnection con)
         throws java.io.IOException
抛出:
java.io.IOException
方法详细信息

getStatusCode

public int getStatusCode()

getResponseHeader

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

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.

返回:
response body stream
抛出:
QQConnectException
另请参见:
disconnect()

asString

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

返回:
response body
抛出:
QQConnectException

asDocument

public org.w3c.dom.Document asDocument()
                                throws QQConnectException
Returns the response body as org.w3c.dom.Document.
Disconnects the internal HttpURLConnection silently.

返回:
response body as org.w3c.dom.Document
抛出:
QQConnectException

asJSONObject

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

返回:
response body as sinat4j.org.json.JSONObject
抛出:
QQConnectException

asJSONArray

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

返回:
response body as sinat4j.org.json.JSONArray
抛出:
QQConnectException

asReader

public java.io.InputStreamReader asReader()

disconnect

public void disconnect()

unescape

public static java.lang.String unescape(java.lang.String original)
Unescape UTF-8 escaped characters to string.

参数:
original - The string to be unescaped.
返回:
The unescaped string

toString

public java.lang.String toString()
覆盖:
java.lang.Object 中的 toString

getResponseAsString

public java.lang.String getResponseAsString()

setResponseAsString

public void setResponseAsString(java.lang.String responseAsString)

setStatusCode

public void setStatusCode(int statusCode)