com.thirtyboxes.api
Class RESTResult

java.lang.Object
  extended by com.thirtyboxes.api.RESTResult

public class RESTResult
extends java.lang.Object

Represents the REST object returned from 30 Boxes. The only function of interest to users is the succeeded() function, which along with the ThirtyBoxes.getLastResult() function allows you to query whether the last call to the API succeeded or failed (although this will usually be obvious from whether an object or a null was returned from the function, or whether a MethodCallFailedException was thrown).

Version:
1.0
Author:
keith@kludge.co.uk

Constructor Summary
protected RESTResult(java.io.InputStream responseBody)
          Create a RESTResult object from an HTTP response.
 
Method Summary
protected  org.w3c.dom.Node getNode()
          Gets the first child node of the rsp object (i.e.
protected static java.lang.String getStringFromNodeAttributes(org.w3c.dom.Node node, java.lang.String attributeName)
          Helper function to grab attributes from XML nodes.
 boolean succeeded()
          Returns true if the call that this object is a response to succeeded.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RESTResult

protected RESTResult(java.io.InputStream responseBody)
Create a RESTResult object from an HTTP response. Parses the XML in the response body.

Parameters:
responseBody - An input stream, as returned by HttpClient.executeMethod()
Method Detail

succeeded

public boolean succeeded()
Returns true if the call that this object is a response to succeeded.

Returns:
True if the call succeeded, false if it failed.

getNode

protected org.w3c.dom.Node getNode()
Gets the first child node of the rsp object (i.e. the one with all the useful information in).

Returns:
The first child node.

getStringFromNodeAttributes

protected static java.lang.String getStringFromNodeAttributes(org.w3c.dom.Node node,
                                                              java.lang.String attributeName)
Helper function to grab attributes from XML nodes.

Parameters:
node - The node to get an attribute from.
attributeName - The attribute to get.
Returns:
the attribute value, or null.