com.zasysdev.zamae
Class ZA_Msg_Connection

java.lang.Object
  extended by com.zasysdev.zamae.ZA_Msg_Connection

public final class ZA_Msg_Connection
extends java.lang.Object

This class provides all http connection capability handling

See Also:
HttpConnection

Field Summary
 byte[] rcvdData
          holds the last received data
 byte[] rcvdUncompressedData
          holds the last received data, uncompressed
 
Constructor Summary
ZA_Msg_Connection()
          creator method
ZA_Msg_Connection(java.lang.String a_strAppVersionString, java.lang.String a_method)
          creator method
ZA_Msg_Connection(java.lang.String a_strAppVersionString, java.lang.String a_strDeviceContextString, java.lang.String a_method, java.lang.String a_propertyKey, java.lang.String a_propertyValue, boolean a_bUseEncryption)
          creator method
 
Method Summary
 int ZA_Msg_Connect(java.lang.String a_url, java.lang.String a_message, java.lang.String a_method)
          connects to a URL and sends the message as body
 void ZA_Msg_Connection_Init(za_UI_api a_proshObject, java.lang.String a_strAppVersionString, java.lang.String a_strDeviceContextString, java.lang.String a_strCookieString, java.lang.String a_method, boolean a_bUseEncryption, java.lang.String a_strEncryptionKey)
          Initializator.
 void ZA_Msg_EmptyLastReceivedContent()
          empties the last received data object
 int ZA_Msg_GetAccumReceivedContentLength()
          Getter method: returns the accumulated content length
 int ZA_Msg_GetAccumSentContentLength()
          Getter method: returns the accumulated content length for sent data
 int ZA_Msg_GetLastContentLength()
          Getter method: returns the last content length
 java.lang.String ZA_Msg_GetLastContentType()
          Getter method: returns the last content type string
 java.lang.String ZA_Msg_GetLastException()
          Getter method: returns the last exception message
 byte[] ZA_Msg_GetLastReceivedContentByte()
          Getter method: returns the received content from the server in a byte[] object
 java.lang.String ZA_Msg_GetLastReceivedContentString()
          Getter method: returns the received content from the server in a string object
 int ZA_Msg_GetLastResponseCode()
          Getter method: returns the last HTTP response code
 java.lang.String ZA_Msg_GetLastResponseMessage()
          Getter method: returns the last response message
 int ZA_Msg_GetNoiseLevel()
          gets the actual noise level.
 boolean ZA_Msg_IsConnected()
          tests if a connection is taking place
 int ZA_Msg_PingConnection(java.lang.String a_url)
          tests the connection to a given URL
 void ZA_Msg_ResetNoiseLevel()
          resets the actual noise level to zero.
 void ZA_Msg_SetPropertyKeyValuePair(java.lang.String a_propertyKey, java.lang.String a_propertyValue)
          Initializator.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

rcvdData

public byte[] rcvdData
holds the last received data


rcvdUncompressedData

public byte[] rcvdUncompressedData
holds the last received data, uncompressed

Constructor Detail

ZA_Msg_Connection

public ZA_Msg_Connection(java.lang.String a_strAppVersionString,
                         java.lang.String a_strDeviceContextString,
                         java.lang.String a_method,
                         java.lang.String a_propertyKey,
                         java.lang.String a_propertyValue,
                         boolean a_bUseEncryption)
creator method

Parameters:
a_strAppVersionString - holds the Application Version String which is sent over to the server on every connection
a_strDeviceContextString - holds the Context String. Any valuable data describing the execution context (device capabilites, etc.) is sent in this chunk to be observde by the server
a_method - HTTP connection method: GET, POST, etc.
a_propertyKey - holds ad-hoc http header name
a_propertyValue - holds ad-hoc header value for propertyKey

ZA_Msg_Connection

public ZA_Msg_Connection()
creator method


ZA_Msg_Connection

public ZA_Msg_Connection(java.lang.String a_strAppVersionString,
                         java.lang.String a_method)
creator method

Parameters:
a_strAppVersionString - holds the Application Version String which is sent over to the server on every connection
a_method - HTTP connection method: GET, POST, etc.
Method Detail

ZA_Msg_Connection_Init

public void ZA_Msg_Connection_Init(za_UI_api a_proshObject,
                                   java.lang.String a_strAppVersionString,
                                   java.lang.String a_strDeviceContextString,
                                   java.lang.String a_strCookieString,
                                   java.lang.String a_method,
                                   boolean a_bUseEncryption,
                                   java.lang.String a_strEncryptionKey)
Initializator. Need to be called as to properly define a MsgConnection instance.

Parameters:
a_strAppVersionString - holds the Application Version String which is sent over to the server on every connection
a_strDeviceContextString - holds the Context String. Any valuable data describing the execution context (device capabilites, etc.) is sent in this chunk to be observde by the server
a_strCookieString - holds the cookie string if any.
a_method - HTTP connection method: GET, POST, etc.

ZA_Msg_SetPropertyKeyValuePair

public void ZA_Msg_SetPropertyKeyValuePair(java.lang.String a_propertyKey,
                                           java.lang.String a_propertyValue)
Initializator. Sets a property key/value pair.

Parameters:
a_propertyKey - holds ad-hoc http header name
a_propertyValue - holds ad-hoc header value for propertyKey

ZA_Msg_GetNoiseLevel

public int ZA_Msg_GetNoiseLevel()
gets the actual noise level. Any exception thrown inside this class makes the noise level higher.

Returns:
the noise level

ZA_Msg_ResetNoiseLevel

public void ZA_Msg_ResetNoiseLevel()
resets the actual noise level to zero. Any exception thrown inside this class makes the noise level higher.


ZA_Msg_PingConnection

public int ZA_Msg_PingConnection(java.lang.String a_url)
                          throws java.io.IOException
tests the connection to a given URL

Parameters:
a_url - the url
Returns:
0 if OK -1 if NOT OK (exception thrown) HTTP return code whenever not equal to 200 OK
Throws:
java.io.IOException

ZA_Msg_Connect

public int ZA_Msg_Connect(java.lang.String a_url,
                          java.lang.String a_message,
                          java.lang.String a_method)
                   throws java.io.IOException
connects to a URL and sends the message as body

Parameters:
a_url - url to connect to
a_message - message to send to server
a_method - the HTTP connection method: GET, POST, etc.
Returns:
0 if OK -1 if NOT OK (exception thrown) HTTP return code whenever not equal to 200 OK
Throws:
java.io.IOException

ZA_Msg_IsConnected

public boolean ZA_Msg_IsConnected()
tests if a connection is taking place

Returns:
true if connected false if not connected

ZA_Msg_GetLastResponseCode

public int ZA_Msg_GetLastResponseCode()
Getter method: returns the last HTTP response code

Returns:
returns the last HTTP response code

ZA_Msg_GetLastException

public java.lang.String ZA_Msg_GetLastException()
Getter method: returns the last exception message

Returns:
returns the last exception message

ZA_Msg_GetLastResponseMessage

public java.lang.String ZA_Msg_GetLastResponseMessage()
Getter method: returns the last response message

Returns:
returns the last response message

ZA_Msg_GetLastContentType

public java.lang.String ZA_Msg_GetLastContentType()
Getter method: returns the last content type string

Returns:
returns the last content type string

ZA_Msg_GetLastContentLength

public int ZA_Msg_GetLastContentLength()
Getter method: returns the last content length

Returns:
returns the last content length

ZA_Msg_GetAccumReceivedContentLength

public int ZA_Msg_GetAccumReceivedContentLength()
Getter method: returns the accumulated content length

Returns:
returns the accum content length

ZA_Msg_GetAccumSentContentLength

public int ZA_Msg_GetAccumSentContentLength()
Getter method: returns the accumulated content length for sent data

Returns:
returns the accum content length sent

ZA_Msg_GetLastReceivedContentString

public java.lang.String ZA_Msg_GetLastReceivedContentString()
Getter method: returns the received content from the server in a string object

Returns:
returns the received content from the server in a string object

ZA_Msg_GetLastReceivedContentByte

public byte[] ZA_Msg_GetLastReceivedContentByte()
Getter method: returns the received content from the server in a byte[] object

Returns:
returns the received content from the server in a byte[] object

ZA_Msg_EmptyLastReceivedContent

public void ZA_Msg_EmptyLastReceivedContent()
empties the last received data object