anon.infoservice
Class HTTPConnectionFactory

java.lang.Object
  extended by anon.infoservice.HTTPConnectionFactory

public class HTTPConnectionFactory
extends java.lang.Object

This class creates all instances of HTTPConnection for the JAP client and is a singleton.


Field Summary
static int HTTP_ENCODING_GZIP
           
static java.lang.String HTTP_ENCODING_GZIP_STRING
           
static int HTTP_ENCODING_PLAIN
           
static int HTTP_ENCODING_ZLIB
           
static java.lang.String HTTP_ENCODING_ZLIB_STRING
           
 
Method Summary
 HTTPClient.HTTPConnection createHTTPConnection(ListenerInterface target)
          This method creates a new instance of HTTPConnection.
 HTTPClient.HTTPConnection createHTTPConnection(ListenerInterface target, ImmutableProxyInterface a_proxySettings)
          This method creates a new instance of HTTPConnection using the specified proxy settings (ignoring the default settings).
 HTTPClient.HTTPConnection createHTTPConnection(ListenerInterface target, ImmutableProxyInterface a_proxySettings, int a_encoding, boolean a_bGet, java.util.Vector a_vecNVPairHeaderReplacements)
          This method creates a new instance of HTTPConnection using the specified proxy settings (ignoring the default settings).
 HTTPClient.HTTPConnection createHTTPConnection(ListenerInterface target, int a_encoding, boolean a_bGet)
          This method creates a new instance of HTTPConnection.
 HTTPClient.HTTPConnection createHTTPConnection(ListenerInterface target, int a_encoding, boolean a_bGet, java.util.Vector a_vecNVPairHeaderReplacements)
           
static HTTPConnectionFactory getInstance()
          Returns the instance of HTTPConnectionFactory (Singleton).
 int getTimeout()
          Returns the communication timeout (sec) for new HTTP connections.
 void setNewProxySettings(ImmutableProxyInterface a_proxyInterface, boolean a_bUseAuth)
          This method sets new settings for the proxy server.
 void setTimeout(int a_timeout)
          Sets the communication timeout (sec) for new HTTP connections.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

HTTP_ENCODING_PLAIN

public static final int HTTP_ENCODING_PLAIN
See Also:
Constant Field Values

HTTP_ENCODING_ZLIB

public static final int HTTP_ENCODING_ZLIB
See Also:
Constant Field Values

HTTP_ENCODING_GZIP

public static final int HTTP_ENCODING_GZIP
See Also:
Constant Field Values

HTTP_ENCODING_ZLIB_STRING

public static final java.lang.String HTTP_ENCODING_ZLIB_STRING
See Also:
Constant Field Values

HTTP_ENCODING_GZIP_STRING

public static final java.lang.String HTTP_ENCODING_GZIP_STRING
See Also:
Constant Field Values
Method Detail

getInstance

public static HTTPConnectionFactory getInstance()
Returns the instance of HTTPConnectionFactory (Singleton). If there is no instance, there is a new one created.

Returns:
The HTTPConnectionFactory instance.

setNewProxySettings

public void setNewProxySettings(ImmutableProxyInterface a_proxyInterface,
                                boolean a_bUseAuth)
This method sets new settings for the proxy server. All HTTPConnection instances created after the call of this method will use them. Instances of HTTPConnection which already exist are not influenced by that call. The default after creating the instance of HTTPConnectionFactory is to use no proxy for all new instances of HTTPConnection.

Parameters:
a_proxyInterface - the listener interface of the proxy server; if it is set to null, no proxy is used
a_bUseAuth - indicates whether proxy authentication should be used

setTimeout

public void setTimeout(int a_timeout)
Sets the communication timeout (sec) for new HTTP connections. If this value is zero or lower, a connection never times out. Instances of HTTPConnection which already exist, are not influenced by this method.

Parameters:
a_timeout - The new communication timeout.

getTimeout

public int getTimeout()
Returns the communication timeout (sec) for new HTTP connections. If this value is zero, a connection never times out.

Returns:
The communication timeout for new connections.

createHTTPConnection

public HTTPClient.HTTPConnection createHTTPConnection(ListenerInterface target)
This method creates a new instance of HTTPConnection. The current proxy settings are used.

Parameters:
target - The ListenerInterface of the connection target.
Returns:
A new instance of HTTPConnection with a connection to the specified target and the current proxy settings.

createHTTPConnection

public HTTPClient.HTTPConnection createHTTPConnection(ListenerInterface target,
                                                      int a_encoding,
                                                      boolean a_bGet)
This method creates a new instance of HTTPConnection. The current proxy settings are used.

Parameters:
target - The ListenerInterface of the connection target.
a_encoding - http encoding used to send the data (e.g. HTTP_ENCODING_ZLIB)
a_bGet - if encoding is set to another value than HTTP_ENCODING_PLAIN, it must be specified if this is a get or a post statement
Returns:
A new instance of HTTPConnection with a connection to the specified target and the current proxy settings.

createHTTPConnection

public HTTPClient.HTTPConnection createHTTPConnection(ListenerInterface target,
                                                      int a_encoding,
                                                      boolean a_bGet,
                                                      java.util.Vector a_vecNVPairHeaderReplacements)
Parameters:
target -
a_encoding -
a_bGet -
a_vecNVPairHeaderReplacements - you may add some HTTPClient.NVPair headers
Returns:

createHTTPConnection

public HTTPClient.HTTPConnection createHTTPConnection(ListenerInterface target,
                                                      ImmutableProxyInterface a_proxySettings)
This method creates a new instance of HTTPConnection using the specified proxy settings (ignoring the default settings).

Parameters:
target - The ListenerInterface of the connection target.
a_proxySettings - The proxy settings to use for this single connection. If the proxy settings are null, no proxy is used.
Returns:
A new instance of HTTPConnection with a connection to the specified target and the current proxy settings.

createHTTPConnection

public HTTPClient.HTTPConnection createHTTPConnection(ListenerInterface target,
                                                      ImmutableProxyInterface a_proxySettings,
                                                      int a_encoding,
                                                      boolean a_bGet,
                                                      java.util.Vector a_vecNVPairHeaderReplacements)
This method creates a new instance of HTTPConnection using the specified proxy settings (ignoring the default settings).

Parameters:
target - The ListenerInterface of the connection target.
a_proxySettings - The proxy settings to use for this single connection. If the proxy settings are null, no proxy is used.
a_bGet - if encoding is set to another value than HTTP_ENCODING_PLAIN, it must be specified if this is a get or a post statement
a_encoding - http encoding used to send the data (e.g. HTTP_ENCODING_ZLIB)
Returns:
A new instance of HTTPConnection with a connection to the specified target and the current proxy settings.