Awake SQL v1.2.1

org.awakefw.commons.api.client
Class HttpProtocolParameters

java.lang.Object
  extended by org.awakefw.commons.api.client.HttpProtocolParameters

public final class HttpProtocolParameters
extends Object

Allows to define some parameters for the Awake session:

Allows also to store http protocol parameters that will be passed to the underlying DefaultHttpClient class of the Jakarta HttpClient Library library.

Use this class only if you want to change the default values of the HttpClient library and pass the created instance to AwakeFileSession or AwakeConnection.

For example, the following change the default connection timeout to 10 seconds and the default socket timeout to 60 seconds:

 String url = "https://www.acme.org/AwakeFileManager";
 String username = "myUsername";
 char [] password = {'m', 'y', 'P', 'a', 's', 's', 'w', 'o', 'r', 'd'}; 
          
 HttpProtocolParameters httpProtocolParameters = new HttpProtocolParameters();
  
 // Sets the timeout until a connection is established to 10 seconds
 httpProtocolParameters.setHttpClientParameter(
 "http.connection.timeout", new Integer(10 * 1000));
  
 // Sets the socket timeout (SO_TIMEOUT) to 60 seconds
 httpProtocolParameters.setHttpClientParameter("http.socket.timeout",
 new Integer(60 * 1000));
          
 // We will use no proxy
 HttpProxy httpProxy = null;
          
 AwakeFileSession awakeFileSession 
 = new AwakeFileSession(url, username, password, httpProxy, httpProtocolParameters);
  
 // Etc.
 
See
HttpComponents Tutorial for more info on HTTP parameters.

Since:
1.0

Field Summary
static boolean ACCEPT_ALL_SSL_CERTIFICATES
          The default acceptance for self signed SSL certificates
static int DEFAULT_DOWNLOAD_BUFFER_SIZE
          The default Buffer size for download and copy
static boolean DEFAULT_HTML_ENCODING_ON
          The default behavior for html encoding
static int DEFAULT_MAX_LENGTH_FOR_STRING
          The default maximum authorized length for a string for upload or download
static int DEFAULT_UPLOAD_BUFFER_SIZE
          The default buffer size when uploading a file
 
Constructor Summary
HttpProtocolParameters()
          Constructor.
 
Method Summary
 void clearHttpClientParameters()
          Removes all parameters from this collection.
 int getDownloadBufferSize()
          Returns the buffer size when downloading files.
 char[] getEncryptionPassword()
          Returns the encryption Password that encrypts http request parameters.
 Object getHttpClientParameter(String name)
          Gets the value of this HttpClient Library parameter.
 Set<String> getHttpClientParameterNames()
          Returns the new parameters key set.
 Map<String,Object> getHttpClientParameters()
          Returns the HttpClient Parameters.
 int getMaxLengthForString()
          Returns the maximum authorized length for a string for upload or download (in order to avoid OutOfMemoryException on client and server side).
 int getUploadBufferSize()
          Returns the buffer size when uploading files.
 boolean isAcceptAllSslCertificates()
          Says if client sides allows HTTPS call with all SSL Certificates, including "invalid" or self-signed Certificates.
 boolean isHtmlEncodingOn()
          Says if the upload/download of Clob using character stream or ASCII stream is html encoded.
 void setAcceptAllSslCertificates(boolean acceptAllSslCertificates)
          Sets if client sides must allow HTTPS call with all SSL Certificates, including "invalid" or self-signed Certificates.
 void setDownloadBufferSize(int downloadBufferSize)
          Sets the buffer size when downloading files.
 void setEncryptionPassword(char[] encryptionPassword)
          Sets the encryption Password that encrypts http request parameters.
 void setHtmlEncodingOn(boolean htmlEncodeOn)
          Says if the upload/download of Clob using character stream or ASCII stream must be html encoded.
 void setHttpClientParameter(String name, Object value)
          Sets the value of this HttpClient Library parameter.
 void setHttpClientParameters(Map<String,Object> httpClientParameters)
          Sets the HttpClient Parameters.
 void setMaxLengthForString(int maxLengthForString)
          Sets the maximum authorized length for a string for upload or download (in order to avoid OutOfMemoryException on client and server side).
 void setUploadBufferSize(int uploadBufferSize)
          Sets the buffer size when uploading files.
 String toString()
          Returns a clean representation of the HttpProtocolParameters instance.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ACCEPT_ALL_SSL_CERTIFICATES

public static final boolean ACCEPT_ALL_SSL_CERTIFICATES
The default acceptance for self signed SSL certificates

See Also:
Constant Field Values

DEFAULT_DOWNLOAD_BUFFER_SIZE

public static final int DEFAULT_DOWNLOAD_BUFFER_SIZE
The default Buffer size for download and copy

See Also:
Constant Field Values

DEFAULT_HTML_ENCODING_ON

public static final boolean DEFAULT_HTML_ENCODING_ON
The default behavior for html encoding

See Also:
Constant Field Values

DEFAULT_MAX_LENGTH_FOR_STRING

public static final int DEFAULT_MAX_LENGTH_FOR_STRING
The default maximum authorized length for a string for upload or download

See Also:
Constant Field Values

DEFAULT_UPLOAD_BUFFER_SIZE

public static final int DEFAULT_UPLOAD_BUFFER_SIZE
The default buffer size when uploading a file

See Also:
Constant Field Values
Constructor Detail

HttpProtocolParameters

public HttpProtocolParameters()
Constructor.

Method Detail

clearHttpClientParameters

public void clearHttpClientParameters()
Removes all parameters from this collection.


getDownloadBufferSize

public int getDownloadBufferSize()
Returns the buffer size when downloading files.

Returns:
the buffer size when downloading files

getEncryptionPassword

public char[] getEncryptionPassword()
Returns the encryption Password that encrypts http request parameters.

Returns:
the encryption Password that encrypts http request parameters

getHttpClientParameter

public Object getHttpClientParameter(String name)
Gets the value of this HttpClient Library parameter.

Parameters:
name - the parameter name *
Returns:
the parameter value
Throws:
IllegalArgumentException - if name is null

getHttpClientParameterNames

public Set<String> getHttpClientParameterNames()
Returns the new parameters key set.

Returns:
the new parameters key set.
See Also:
Map.keySet()

getHttpClientParameters

public Map<String,Object> getHttpClientParameters()
Returns the HttpClient Parameters.

Returns:
the HttpClient Parameters

getMaxLengthForString

public int getMaxLengthForString()
Returns the maximum authorized length for a string for upload or download (in order to avoid OutOfMemoryException on client and server side).

Returns:
the maximum authorized length for a string for upload or download

getUploadBufferSize

public int getUploadBufferSize()
Returns the buffer size when uploading files.

Returns:
the buffer size when uploading files

isAcceptAllSslCertificates

public boolean isAcceptAllSslCertificates()
Says if client sides allows HTTPS call with all SSL Certificates, including "invalid" or self-signed Certificates.

Returns:
true if client sides allows HTTPS call with all SSL Certificates

isHtmlEncodingOn

public boolean isHtmlEncodingOn()
Says if the upload/download of Clob using character stream or ASCII stream is html encoded. (For Awake SQL only).

Returns:
true if the upload/download of Clob is html encoded

setAcceptAllSslCertificates

public void setAcceptAllSslCertificates(boolean acceptAllSslCertificates)
Sets if client sides must allow HTTPS call with all SSL Certificates, including "invalid" or self-signed Certificates.

Parameters:
acceptAllSslCertificates - true if we want client client sides to allow HTTPS call with all SSL Certificates

setDownloadBufferSize

public void setDownloadBufferSize(int downloadBufferSize)
Sets the buffer size when downloading files.

Parameters:
downloadBufferSize - the buffer size when downloading files to set

setEncryptionPassword

public void setEncryptionPassword(char[] encryptionPassword)
Sets the encryption Password that encrypts http request parameters.

Parameters:
encryptionPassword - the encryption Password that encrypts http request parameters

setHtmlEncodingOn

public void setHtmlEncodingOn(boolean htmlEncodeOn)
Says if the upload/download of Clob using character stream or ASCII stream must be html encoded. (For Awake SQL only).

Parameters:
htmlEncodeOn - true to html encode the upload/download of Clob, else false

setHttpClientParameter

public void setHttpClientParameter(String name,
                                   Object value)
Sets the value of this HttpClient Library parameter.

Parameters:
name - the parameter name
value - the parameter value
Throws:
IllegalArgumentException - if name is null

setHttpClientParameters

public void setHttpClientParameters(Map<String,Object> httpClientParameters)
Sets the HttpClient Parameters.

Parameters:
httpClientParameters - the HttpClient Parameters to set

setMaxLengthForString

public void setMaxLengthForString(int maxLengthForString)
Sets the maximum authorized length for a string for upload or download (in order to avoid OutOfMemoryException on client and server side).

Parameters:
maxLengthForString - the maximum authorized length for a string for upload or download

setUploadBufferSize

public void setUploadBufferSize(int uploadBufferSize)
Sets the buffer size when uploading files.

Parameters:
uploadBufferSize - the buffer size when uploading files

toString

public String toString()
Returns a clean representation of the HttpProtocolParameters instance.

Overrides:
toString in class Object
Returns:
a clean representation of the HttpProtocolParameters instance

Awake SQL v1.2.1

Awake SQL - Virtual JDBC Driver over HTTP for Android, Swing and JavaFX
Android & Desktop Edition allow easy access to majors remote SQL databases with regular JDBC calls:
DB2 - H2 - HSQLDB (HyperSQL) - Informix - Ingres - MySQL - Oracle - PostgreSQL - SQL Server - Sybase - Teradata
Copyright © 2012 Kawan Softwares SAS