net.netheos.pcsapi.request
Class CResponse

java.lang.Object
  extended by net.netheos.pcsapi.request.CResponse
All Implemented Interfaces:
Closeable

public class CResponse
extends Object
implements Closeable

Represents a response returned by an HTTP client.


Constructor Summary
CResponse(org.apache.http.client.methods.HttpUriRequest request, org.apache.http.HttpResponse response)
           
 
Method Summary
 Document asDom()
          Get the response as a DOM
 org.json.JSONArray asJSONArray()
          Get the response as a json array
 org.json.JSONObject asJSONObject()
          Get the response as a json object
 String asString()
          Extracts string from input stream
 void close()
           
 long getContentLength()
           
 String getContentType()
           
 Headers getHeaders()
          Get the response headers
 String getMethod()
           
 String getReason()
           
 int getStatus()
           
 URI getUri()
           
 InputStream openStream()
          Open a raw stream on the response body.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CResponse

public CResponse(org.apache.http.client.methods.HttpUriRequest request,
                 org.apache.http.HttpResponse response)
Method Detail

getStatus

public int getStatus()

getMethod

public String getMethod()

getUri

public URI getUri()

getContentType

public String getContentType()

getReason

public String getReason()

close

public void close()
           throws IOException
Specified by:
close in interface Closeable
Throws:
IOException

asString

public String asString()
Extracts string from input stream

Returns:
Get the response as a String

asJSONObject

public org.json.JSONObject asJSONObject()
Get the response as a json object

Returns:
The json value

asDom

public Document asDom()
Get the response as a DOM

Returns:
The DOM document

asJSONArray

public org.json.JSONArray asJSONArray()
Get the response as a json array

Returns:
The json value

getContentLength

public long getContentLength()
Returns:
entity content length, or 0 if response has no entity, or a negative number if unknown.

getHeaders

public Headers getHeaders()
Get the response headers

Returns:
The headers

openStream

public InputStream openStream()
Open a raw stream on the response body.

Returns:
The stream


Copyright © 2014. All Rights Reserved.