com.universaldevices.soap
Class UDHTTPRequest

java.lang.Object
  extended by com.universaldevices.soap.AbstractHTTPRequest
      extended by com.universaldevices.soap.UDHTTPRequest

public class UDHTTPRequest
extends AbstractHTTPRequest

UDHTTPRequest class encapsulates an HTTP request to ISY. This class may also be used for other types of HTTP request and it's the superclass to UDSOAPRequest

Author:
UD Architect
See Also:
UDSOAPRequest

Field Summary
protected  java.net.Socket s
          The socket, which in some cases, remains open even after the request is completed
 
Fields inherited from class com.universaldevices.soap.AbstractHTTPRequest
address, ba, closed, credentials, is, method, os, sc, SEND_BUFFER_SIZE, url_path
 
Constructor Summary
protected UDHTTPRequest(java.net.InetSocketAddress address, java.lang.String url_path)
          Constructor
protected UDHTTPRequest(java.net.InetSocketAddress address, java.lang.String method, java.lang.String url_path)
          Constructor
 
Method Summary
 void close(int status)
          Releases all the resources
 java.lang.String getProtocol()
           
 UDHTTPResponse getServerResponse(java.lang.StringBuffer header, java.lang.StringBuffer body, boolean keep_alive, java.lang.Object device)
          Issues the request to the server and returns the response
 java.net.Socket getSocket()
           
 boolean isSSL()
           
 UDHTTPResponse post(java.lang.StringBuffer header, byte[] body, boolean keep_alive, java.lang.Object device, IUpdaterClient view)
          Simple post
 
Methods inherited from class com.universaldevices.soap.AbstractHTTPRequest
create, create, create, get, getFile, getHeader, getHost, getHostAndPort, getPort, getServerResponse, getSocketTimeoutMillis, getURL, post, setSendBufferSize, setSocketTimeoutMillis
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

s

protected java.net.Socket s
The socket, which in some cases, remains open even after the request is completed

Constructor Detail

UDHTTPRequest

protected UDHTTPRequest(java.net.InetSocketAddress address,
                        java.lang.String method,
                        java.lang.String url_path)
Constructor

Parameters:
address - - the address segment of the URL including port
method - - the method either GET or POST
url_path - - the path segment of the URL (i.e. /web/nodescnf.xml)

UDHTTPRequest

protected UDHTTPRequest(java.net.InetSocketAddress address,
                        java.lang.String url_path)
Constructor

Note: the method is defaulted to "GET"

Parameters:
address - - the address segment of the URL including port
url_path - - the path segment of the URL (i.e. /web/nodescnf.xml)
Method Detail

getProtocol

public java.lang.String getProtocol()
Specified by:
getProtocol in class AbstractHTTPRequest
Returns:
- return http

getServerResponse

public UDHTTPResponse getServerResponse(java.lang.StringBuffer header,
                                        java.lang.StringBuffer body,
                                        boolean keep_alive,
                                        java.lang.Object device)
Issues the request to the server and returns the response

The response is of type UDHTTPResponse
Use this method to encapsulate requests to ISY

Specified by:
getServerResponse in class AbstractHTTPRequest
Parameters:
header - - the header for the request
body - - the body for the request if any (in case of POST)
keep_alive - - whether or not the connection should be kept alive
device - - the UDProxyDevice object
Returns:
- the response from the server encapsulated in UDHTTPResponse
See Also:
UDHTTPResponse, UDProxyDevice

post

public UDHTTPResponse post(java.lang.StringBuffer header,
                           byte[] body,
                           boolean keep_alive,
                           java.lang.Object device,
                           IUpdaterClient view)
Simple post

The response is of type UDHTTPResponse
Use this method to encapuslate requests to ISY

Specified by:
post in class AbstractHTTPRequest
Parameters:
header - - the header for the request
body - - the body for the request if any (in case of POST)
keep_alive - - whether or not the connection should be kept alive
device - - the UDProxyDevice object
Returns:
- the response from the server encapsulated in UDHTTPResponse
See Also:
UDHTTPResponse, UDProxyDevice

close

public void close(int status)
Releases all the resources

Releases all resources and closes all the connection which this object holds

Specified by:
close in class AbstractHTTPRequest
Parameters:
status - - @depracated

getSocket

public java.net.Socket getSocket()
Specified by:
getSocket in class AbstractHTTPRequest
Returns:
- returns the socket

isSSL

public boolean isSSL()
Specified by:
isSSL in class AbstractHTTPRequest
Returns:
- whether or not this request is SSL based