com.fourspaces.couchdb
Class CouchResponse

java.lang.Object
  extended by com.fourspaces.couchdb.CouchResponse

public class CouchResponse
extends Object

The CouchResponse parses the HTTP response returned by the CouchDB server. This is almost never called directly by the user, but indirectly through the Session and Database objects.

Given a CouchDB response, it will determine if the request was successful (status 200,201,202), or was an error. If there was an error, it parses the returned json error message.

Author:
mbreese

Method Summary
 net.sf.json.JSONObject getBodyAsJSON()
          Returns the body of the response as a JSON Object (such as for a document)
 net.sf.json.JSONArray getBodyAsJSONArray()
          Retrieves the body of the request as a JSONArray object.
 String getErrorId()
          What was the error id?
 String getErrorReason()
          what was the error reason given?
 String getHeader(String key)
          Retrieves a specific header from the response (not really used anymore)
 boolean isOk()
          Was the request successful?
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

toString

public String toString()
Overrides:
toString in class Object

getBodyAsJSONArray

public net.sf.json.JSONArray getBodyAsJSONArray()
Retrieves the body of the request as a JSONArray object. (such as listing database names)

Returns:

isOk

public boolean isOk()
Was the request successful?

Returns:

getErrorId

public String getErrorId()
What was the error id?

Returns:

getErrorReason

public String getErrorReason()
what was the error reason given?

Returns:

getBodyAsJSON

public net.sf.json.JSONObject getBodyAsJSON()
Returns the body of the response as a JSON Object (such as for a document)

Returns:

getHeader

public String getHeader(String key)
Retrieves a specific header from the response (not really used anymore)

Parameters:
key -
Returns:


Copyright © 2012. All Rights Reserved.