atg.rest.client
Class RestResult

java.lang.Object
  extended by atg.rest.client.RestResult

public class RestResult
extends java.lang.Object

A client side class which encapsulates the result of a Rest call. To get the underlying java.net.HttpURLConnection object, call getConnection().

See Also:
HttpURLConnection

Field Summary
static java.lang.String CLASS_VERSION
          Class version string
 
Method Summary
 void close()
          Closes the result.
 java.net.HttpURLConnection getConnection()
          Returns the underlying HttpURLConnection object
 java.io.InputStream getInputStream()
          Returns the input stream from the response
 int getResponseCode()
          Returns the http response code for the request
 java.lang.String getResponseMessage()
          Returns the http response message for the request.
 RestSession getSession()
          Returns the RestSession object this RestResult is associated with
 java.lang.String readInputStream()
          Convenience method for reading the input stream in its entirety.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLASS_VERSION

public static java.lang.String CLASS_VERSION
Class version string

Method Detail

getSession

public RestSession getSession()
Returns the RestSession object this RestResult is associated with

Returns:
the value of session

getConnection

public java.net.HttpURLConnection getConnection()
Returns the underlying HttpURLConnection object

Returns:
the value of connection

readInputStream

public java.lang.String readInputStream()
                                 throws java.io.IOException
Convenience method for reading the input stream in its entirety. Note that this method should only be used when reading text from the input stream. It will not handle binary data. Call getInputStream() to read binary data.

Returns:
a String containing the input stream
Throws:
java.io.IOException - if an error occurs reading the input stream.

getResponseCode

public int getResponseCode()
                    throws java.io.IOException
Returns the http response code for the request

Throws:
java.io.IOException - if the underlying getResponseCode() call throws an IOException

getResponseMessage

public java.lang.String getResponseMessage()
                                    throws java.io.IOException
Returns the http response message for the request.

Throws:
java.io.IOException - if the underlying getResponseMessage() call throws an IOException

getInputStream

public java.io.InputStream getInputStream()
                                   throws java.io.IOException
Returns the input stream from the response

Throws:
java.io.IOException - if the underlying getInputStream() call throws an IOException

close

public void close()
Closes the result. This method should be called before issuing another request on the RestSession.