com.universaldevices.soap
Class UDHTTPResponse

java.lang.Object
  extended by com.universaldevices.soap.UDHTTPResponse
All Implemented Interfaces:
IUpdaterResponse

public class UDHTTPResponse
extends java.lang.Object
implements IUpdaterResponse

This class encapsulates an HTTP response as returned by ISY (or other servers).

The instances of this class are constructed by UDHTTPRequest objects and as such have no development significance

Author:
UD Architect

Field Summary
 byte[] bbody
          The body of the response (binary)
 java.lang.String body
          The body of the response (localized String)
 int contentIndex
           
 UDProxyDevice device
          The UDProxyDevice from which this response is received
static int INVALID_CONTENT_LENGTH
           
 java.io.InputStream is
          Input stream
 boolean opStat
          Whether or not the request was successful
 java.io.OutputStream os
          Output stream
 java.net.Socket s
          The socket being used (which might have been kept open)
 java.lang.String sid
          The subscription ID (UPnP specific)
 int status
          The status of response; this is an HTTP status code
 
Constructor Summary
UDHTTPResponse(int status, UDProxyDevice device)
          Constructor
UDHTTPResponse(java.lang.Object dev)
          Constructor
 
Method Summary
 java.lang.Object getBody()
          Returns the body based on the content type
 int getContentLen()
           
 java.io.InputStream getInputStream()
          The input stream
 java.io.OutputStream getOutputStream()
          The output stream
 java.net.Socket getSocket()
          The socket
 boolean hasSucceeded()
          Whether or not the request has succeeded
static UDHTTPResponse parse(java.io.ByteArrayOutputStream data)
          Parses the HTTP header
static UDHTTPResponse parse(java.io.ByteArrayOutputStream data, java.lang.Object device)
          Parses the HTTP header
 void setContentLen(int newContentLen)
           
 void setStatus(int status)
          Sets the status for this object
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INVALID_CONTENT_LENGTH

public static final int INVALID_CONTENT_LENGTH
See Also:
Constant Field Values

sid

public java.lang.String sid
The subscription ID (UPnP specific)


status

public int status
The status of response; this is an HTTP status code


opStat

public boolean opStat
Whether or not the request was successful


body

public java.lang.String body
The body of the response (localized String)


bbody

public byte[] bbody
The body of the response (binary)


s

public java.net.Socket s
The socket being used (which might have been kept open)


is

public java.io.InputStream is
Input stream


os

public java.io.OutputStream os
Output stream


device

public UDProxyDevice device
The UDProxyDevice from which this response is received


contentIndex

public int contentIndex
Constructor Detail

UDHTTPResponse

public UDHTTPResponse(int status,
                      UDProxyDevice device)
Constructor

Parameters:
status - - the status of the request (successful or not)
device - - the UDProxyDevice from which this response is received
See Also:
UDProxyDevice

UDHTTPResponse

public UDHTTPResponse(java.lang.Object dev)
Constructor

Parameters:
dev - - the device from which this response is received
See Also:
UDProxyDevice
Method Detail

hasSucceeded

public boolean hasSucceeded()
Whether or not the request has succeeded

Specified by:
hasSucceeded in interface IUpdaterResponse
Returns:
- whether or not the operation (request for program update)

getSocket

public java.net.Socket getSocket()
The socket

Specified by:
getSocket in interface IUpdaterResponse
Returns:
- the socket which issued the request for program update

getInputStream

public java.io.InputStream getInputStream()
The input stream

Specified by:
getInputStream in interface IUpdaterResponse
Returns:
- the input stream for the current open socket

getOutputStream

public java.io.OutputStream getOutputStream()
The output stream

Specified by:
getOutputStream in interface IUpdaterResponse
Returns:
- the output stream for the current open socket

setStatus

public void setStatus(int status)
Sets the status for this object

Parameters:
status - - the status

parse

public static UDHTTPResponse parse(java.io.ByteArrayOutputStream data)
Parses the HTTP header

Parameters:
data - - the HTTP header
Returns:
- the UDHTTPResponse representing the response

parse

public static UDHTTPResponse parse(java.io.ByteArrayOutputStream data,
                                   java.lang.Object device)
Parses the HTTP header

Parameters:
data - - the response to be parsed
device - - the device from which this response is received
Returns:
- the UDHTTPResponse representing the response

getBody

public java.lang.Object getBody()
Returns the body based on the content type

Returns:
- the body based on the body's content type (null if none)

getContentLen

public int getContentLen()
Returns:
the content_len

setContentLen

public void setContentLen(int newContentLen)