com.ibm.dse.cs.servlet
Class HttpURLConnectionThin

java.lang.Object
  |
  +--com.ibm.dse.cs.servlet.HttpURLConnectionThin

public class HttpURLConnectionThin
extends java.lang.Object

The HttpURLConnectionThin class is used to establish a client/server connection.


Constructor Summary
HttpURLConnectionThin()
          This constructor creates a HttpURLConnectionThin object.
HttpURLConnectionThin(java.net.URL u, java.lang.String aSessionType, java.lang.String aKeyRingClass, boolean aKeepAlive)
          This constructor creates a HttpURLConnectionThin object.
 
Method Summary
static java.lang.String base64Encode(java.lang.String str)
          This method encodes the given string using the base64-encoding specified in RFC-2045 (Section 6.8).
 void connect()
          Opens a connection with the server.
 void disconnect()
          Disconnects with the server.
 int getContentLength()
          Gets the contentLength property (int) value.
 java.io.DataInputStream getInputStream()
          Gets the is property (DataInputStream) value.
 java.io.DataOutputStream getOutputStream()
          Gets the os property (DataOutputStream) value.
 java.lang.String getSessionID()
          Gets the session id property (String) value.
 java.lang.String getUserAgent()
          Gets the fieldUserAgent property (String) value.
 void readHeaders()
          Reads the headers of the response.
 java.lang.String readLine()
          Reads a line of the response.
 void reset()
           
 void setBasicAuthenticationHeader(java.lang.String userAndPasswordId)
          Sets the serverCredentials property (String) value.
 void setContentLength(int length)
          Sets the contentLength property (int) value.
 void setProxy(java.lang.String aProxyHost, int aProxyPort)
          Sets the proxyHost and proxyPort properties values.
 void setProxyBasicAuthenticationHeader(java.lang.String userAndPasswordId)
          Sets the proxyCredentials property (String) value.
 void setSessionId(java.lang.String sessionId)
          Sets the fieldSessionId property (String) value.
 void setUserAgent(java.lang.String userAgent)
          Sets the fieldUserAgent property (String) value.
 boolean usingCookies()
          Returns true if cookies are used.
 boolean usingProxy()
          Returns true if proxy is used.
 void writeHeaders()
          Writes the headers of the request.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HttpURLConnectionThin

public HttpURLConnectionThin()
This constructor creates a HttpURLConnectionThin object.

HttpURLConnectionThin

public HttpURLConnectionThin(java.net.URL u,
                             java.lang.String aSessionType,
                             java.lang.String aKeyRingClass,
                             boolean aKeepAlive)
This constructor creates a HttpURLConnectionThin object.
Parameters:
u - java.net.URL
aSessionType - java.lang.String
aKeyRingClass - java.lang.String
aKeepAlive - boolean
Method Detail

base64Encode

public static final java.lang.String base64Encode(java.lang.String str)
This method encodes the given string using the base64-encoding specified in RFC-2045 (Section 6.8). It's used for example in the "Basic" authorization scheme.
Parameters:
str - the string
Returns:
the base64-encoded str

connect

public void connect()
             throws java.lang.Exception
Opens a connection with the server.

disconnect

public void disconnect()
Disconnects with the server.

getContentLength

public int getContentLength()
Gets the contentLength property (int) value.
Returns:
int

getInputStream

public java.io.DataInputStream getInputStream()
                                       throws java.io.IOException
Gets the is property (DataInputStream) value.
Returns:
java.io.DataInputStream

getOutputStream

public java.io.DataOutputStream getOutputStream()
                                         throws java.io.IOException
Gets the os property (DataOutputStream) value.
Returns:
java.io.DataOutputStream

getSessionID

public java.lang.String getSessionID()
Gets the session id property (String) value.
Returns:
java.lang.String

getUserAgent

public java.lang.String getUserAgent()
Gets the fieldUserAgent property (String) value.
Returns:
java.lang.String

readHeaders

public void readHeaders()
                 throws java.lang.Exception
Reads the headers of the response.

readLine

public final java.lang.String readLine()
                                throws java.io.IOException
Reads a line of the response.

reset

public void reset()

setBasicAuthenticationHeader

public void setBasicAuthenticationHeader(java.lang.String userAndPasswordId)
Sets the serverCredentials property (String) value.
Parameters:
userAndPasswordId - java.lang.String

setContentLength

public void setContentLength(int length)
Sets the contentLength property (int) value.
Parameters:
length - int

setProxy

public void setProxy(java.lang.String aProxyHost,
                     int aProxyPort)
Sets the proxyHost and proxyPort properties values.
Parameters:
proxyHost - String
proxyPort - int

setProxyBasicAuthenticationHeader

public void setProxyBasicAuthenticationHeader(java.lang.String userAndPasswordId)
Sets the proxyCredentials property (String) value.
Parameters:
userAndPasswordId - java.lang.String

setSessionId

public void setSessionId(java.lang.String sessionId)
Sets the fieldSessionId property (String) value.
Parameters:
sessionId - String

setUserAgent

public void setUserAgent(java.lang.String userAgent)
Sets the fieldUserAgent property (String) value.
Parameters:
fieldUserAgent - java.lang.String

usingCookies

public boolean usingCookies()
Returns true if cookies are used.
Returns:
boolean

usingProxy

public boolean usingProxy()
Returns true if proxy is used.
Returns:
boolean

writeHeaders

public void writeHeaders()
                  throws java.io.IOException
Writes the headers of the request. Note: If you are using cookies to maintain the session the cookie must be the first parameter in the request header.