Jitsi: the OpenSource Java VoIP and Instant Messaging client.

net.java.sip.communicator.service.httputil
Class HttpUtils.HTTPResponseResult

java.lang.Object
  extended by net.java.sip.communicator.service.httputil.HttpUtils.HTTPResponseResult
Enclosing class:
HttpUtils

public static class HttpUtils.HTTPResponseResult
extends Object

Utility class wraps the http requests result and some utility methods for retrieving info and content for the result.


Field Summary
(package private)  org.apache.http.HttpEntity entity
          The httpclient entity.
(package private)  org.apache.http.impl.client.DefaultHttpClient httpClient
          The httpclient.
 
Constructor Summary
HttpUtils.HTTPResponseResult(org.apache.http.HttpEntity entity, org.apache.http.impl.client.DefaultHttpClient httpClient)
          Creates HTTPResponseResult.
 
Method Summary
 InputStream getContent()
          Returns a content stream of the entity.
 long getContentLength()
          Tells the length of the content, if known.
 String getContentString()
          Returns a content string of the entity.
 String[] getCredentials()
          Get the credentials used by the request.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

entity

org.apache.http.HttpEntity entity
The httpclient entity.


httpClient

org.apache.http.impl.client.DefaultHttpClient httpClient
The httpclient.

Constructor Detail

HttpUtils.HTTPResponseResult

HttpUtils.HTTPResponseResult(org.apache.http.HttpEntity entity,
                             org.apache.http.impl.client.DefaultHttpClient httpClient)
Creates HTTPResponseResult.

Parameters:
entity - the httpclient entity.
httpClient - the httpclient.
Method Detail

getContentLength

public long getContentLength()
Tells the length of the content, if known.

Returns:
the number of bytes of the content, or a negative number if unknown. If the content length is known but exceeds Long.MAX_VALUE, a negative number is returned.

getContent

public InputStream getContent()
                       throws IOException,
                              IllegalStateException
Returns a content stream of the entity.

Returns:
content stream of the entity.
Throws:
IOException - if the stream could not be created
IllegalStateException - if content stream cannot be created.

getContentString

public String getContentString()
                        throws IOException
Returns a content string of the entity.

Returns:
content string of the entity.
Throws:
IOException - if the stream could not be created

getCredentials

public String[] getCredentials()
Get the credentials used by the request.

Returns:
the credentials (login at index 0 and password at index 1)

Jitsi: the OpenSource Java VoIP and Instant Messaging client.

Jitsi, the OpenSource Java VoIP and Instant Messaging client.
Distributable under LGPL license.