com.rackspacecloud.client.cloudfiles
Class FilesResponse

java.lang.Object
  extended by com.rackspacecloud.client.cloudfiles.FilesResponse
Direct Known Subclasses:
FilesResponseExt

public class FilesResponse
extends java.lang.Object


Field Summary
protected  org.apache.http.HttpEntity entity
           
protected static org.apache.log4j.Logger logger
           
protected  org.apache.http.HttpResponse response
           
 
Constructor Summary
FilesResponse(org.apache.http.HttpResponse response)
           
 
Method Summary
 long getAccountBytesUsed()
          Get the number of bytes used by the container
 int getAccountContainerCount()
          Get the number of objects in the header
 java.lang.String getAuthToken()
          This method makes no assumptions about the user having been logged in.
 long getContainerBytesUsed()
          Get the number of bytes used by the container
 int getContainerObjectCount()
          Get the number of objects in the header
 java.lang.String getContentEncoding()
           
 java.lang.String getContentLength()
          Get the content length of the response (as reported in the header)
 java.lang.String getContentType()
          Get the content type
 java.lang.String getETag()
          The Etag is the same as the objects MD5SUM
 java.lang.String getLastModified()
          The last modified header
 byte[] getResponseBody()
          Get the body of the response as a byte array
 java.io.InputStream getResponseBodyAsStream()
          Get the response body as a Stream
 java.lang.String getResponseBodyAsString()
          Returns the response body as text
 org.apache.http.Header getResponseHeader(java.lang.String headerName)
          Returns the specified response header.
 org.apache.http.Header[] getResponseHeaders()
          The HTTP headers from the response
 org.apache.http.Header[] getResponseHeaders(java.lang.String headerName)
          Returns the response headers with the given name.
 int getStatusCode()
          Get the HTTP status code
 org.apache.http.StatusLine getStatusLine()
          The HTTP Status line (both the status code and the status message).
 java.lang.String getStatusMessage()
          Get the HTTP status message
 java.lang.String getStorageURL()
          This method makes no assumptions about the user having been logged in.
 boolean loginSuccess()
          Checks to see if the user managed to login with their credentials.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

response

protected org.apache.http.HttpResponse response

entity

protected org.apache.http.HttpEntity entity

logger

protected static org.apache.log4j.Logger logger
Constructor Detail

FilesResponse

public FilesResponse(org.apache.http.HttpResponse response)
Parameters:
response - The HttpResponse generated
Method Detail

loginSuccess

public boolean loginSuccess()
Checks to see if the user managed to login with their credentials.

Returns:
true is login succeeded false otherwise

getAuthToken

public java.lang.String getAuthToken()
This method makes no assumptions about the user having been logged in. It simply looks for the Storage Token header as defined by FilesConstants.X_STORAGE_TOKEN and if this exists it returns its value otherwise the value returned will be null.

Returns:
null if the user is not logged into Cloud FS or the Storage token

getStorageURL

public java.lang.String getStorageURL()
This method makes no assumptions about the user having been logged in. It simply looks for the Storage URL header as defined by FilesConstants.X_STORAGE_URL and if this exists it returns its value otherwise the value returned will be null.

Returns:
null if the user is not logged into Cloud FS or the Storage URL

getContentType

public java.lang.String getContentType()
Get the content type

Returns:
The content type (e.g., MIME type) of the response

getContentLength

public java.lang.String getContentLength()
Get the content length of the response (as reported in the header)

Returns:
the length of the content

getETag

public java.lang.String getETag()
The Etag is the same as the objects MD5SUM

Returns:
The ETAG

getLastModified

public java.lang.String getLastModified()
The last modified header

Returns:
The last modified header

getResponseHeaders

public org.apache.http.Header[] getResponseHeaders()
The HTTP headers from the response

Returns:
The headers

getStatusLine

public org.apache.http.StatusLine getStatusLine()
The HTTP Status line (both the status code and the status message).

Returns:
The status line

getStatusCode

public int getStatusCode()
Get the HTTP status code

Returns:
The status code

getStatusMessage

public java.lang.String getStatusMessage()
Get the HTTP status message

Returns:
The message portion of the status line

getResponseBodyAsString

public java.lang.String getResponseBodyAsString()
                                         throws java.io.IOException
Returns the response body as text

Returns:
The response body
Throws:
java.io.IOException

getResponseBodyAsStream

public java.io.InputStream getResponseBodyAsStream()
                                            throws java.io.IOException
Get the response body as a Stream

Returns:
An input stream that will return the response body when read
Throws:
java.io.IOException

getResponseBody

public byte[] getResponseBody()
                       throws java.io.IOException
Get the body of the response as a byte array

Returns:
The body of the response.
Throws:
java.io.IOException

getResponseHeader

public org.apache.http.Header getResponseHeader(java.lang.String headerName)
Returns the specified response header. Note that header-name matching is case insensitive.

Parameters:
headerName - - The name of the header to be returned.
Returns:
The specified response header. If the response contained multiple instances of the header, its values will be combined using the ',' separator as specified by RFC2616.

getContainerObjectCount

public int getContainerObjectCount()
Get the number of objects in the header

Returns:
-1 if the header is not present or the correct value as defined by the header

getContainerBytesUsed

public long getContainerBytesUsed()
Get the number of bytes used by the container

Returns:
-1 if the header is not present or the correct value as defined by the header

getAccountContainerCount

public int getAccountContainerCount()
Get the number of objects in the header

Returns:
-1 if the header is not present or the correct value as defined by the header

getAccountBytesUsed

public long getAccountBytesUsed()
Get the number of bytes used by the container

Returns:
-1 if the header is not present or the correct value as defined by the header

getResponseHeaders

public org.apache.http.Header[] getResponseHeaders(java.lang.String headerName)
Returns the response headers with the given name. Note that header-name matching is case insensitive.

Parameters:
headerName - - the name of the headers to be returned.
Returns:
An array of zero or more headers

getContentEncoding

public java.lang.String getContentEncoding()