PhoneGap HTTPS proxy connection properties

The JavaScript API definition of the HTTPS proxy is: Namespace: HttpsConnetion.

This table describes the platform dependent methods, error codes, and object definitions. Its implementation is platform dependent so every platform should provide its own version of the JavaScript code.

PhoneGap HTTPS proxy connection properties
Method/definition/error code Description
CertificateFromFile (path, password, certificateKey) Create a certificate descriptor for the certificate from a file. Calling this method does not immediately load the certificate.
  • path – path of the keystore file
  • password – password of the keystore
  • certificateKey – certificate key of the certificate in the keystore, which is the alias in the Java keytool
CertificateFromAfaria (cn, challengeCode) Create a certificate descriptor for the certificate from the Afaria server. Calling this method does not immediately load the certificate.
  • cn – common name of the certificate
  • challengeCode – challenge code to the Afaria server
CertificateFromStore (certificateKey) Create a certificate descriptor for certificate from files. Calling this method does not immediately load the certificate.
  • certificateKey – certificate key of the certificate in the system keystore, which is the alias in the Java keytool
deleteCertificateFromStore(certificateKey) (iOS only) Delete a cached certificate from the keychain. The iOS client always tries the cached certificate first if available, before requesting the certificate from the Afaria server or loading the certificate from the file system.

In cases where the cached certificate is no longer valid, use this method to delete it from the keychain.

get(url, header, successCB, errorCB, userId, password, timeout, certSource) Send a HTTP request of the GET method.
  • url – the full URL in format https://...[:port]
  • header – header of the request in JSON Object
  • successCB – callback method upon succeess. Its parameter is a string encoded JSON object with these fields:
    {status: number; 
    headers: JSON object with string fields; 
    responseText: Optional if the requested data is text; 
    responseBase64: Optional if the requested data is binary}
    Callers must provide this method otherwise an exception is thrown.
  • errorCB – callback method upon failure. Its parameter is an object with these fields:
    {errorCode: number; 
    description: string; 
    nativeErrorCode: number}
    Callers must provide this method otherwise an exception is thrown.
  • userID – (Optional) for basic authentication
  • password – (Optional) for basic authentication
  • timeout – (Optional) in seconds
  • certSource – (Optional) The JavaScript certificate description object

Returns a JavaScript object that contains an abort() method to abort the current connection

sendRequest(method, url, header, requestBody, successCB, errorCB, userId, password, timeout, certSource) Send a generic HTTP request to the server.
  • url – the full URL in format https://...[:port]
  • header – header of the request in JSON Object
  • requestBody – data as a string value to be sent to server with the request.
  • successCB – callback method upon succeess. Its parameter is a string encoded JSON object with these fields:
    {status: number; 
    headers: JSON object with string fields; 
    responseText: Optional if the requested data is text; 
    responseBase64: Optional if the requested data is binary}
    Callers must provide this method otherwise an exception is thrown.
  • errorCB – callback method upon failure. Its parameter is an object with these fields:
    {errorCode: number; 
    description: string; 
    nativeErrorCode: number}
    Callers must provide this method otherwise an exception is thrown.
  • userID – (Optional) for basic authentication
  • password – (Optional) for basic authentication
  • timeout – (Optional) in seconds
  • certSource – (Optional) The JavaScript certificate description object

Returns a JavaScript object that contains an abort() method to abort the current connection

ERR_UNKNOWN The operation failed with an unknown error.
ERR_INVALID_PARAMETER_VALUE The operation has an invalid parameter.
ERR_MISSING_PARAMETER The operation failed because of a missing parameter.
ERR_NO_SUCH_ACTION There is no such Cordova action for the current service.
ERR_FILE_CERTIFICATE_SOURCE_UNSUPPORTED Certificate from file keystore is not supported on the current platform.
ERR_SYSTEM_CERTIFICATE_SOURCE_UNSUPPORTED Certificate from system keystore is not supported on the current platform.
ERR_AFARIA_CERTIFICATE_SOURCE_UNSUPPORTED Certificate from Afaria server is not supported on the current platform.
ERR_CERTIFICATE_ALIAS_NOT_FOUND The certificate with given alias could not be found.
ERR_CERTIFICATE_FILE_NOT_EXIST The certificate file could not be found.
ERR_CERTIFICATE_INVALID_FILE_FORMAT Incorrect certificate file format.
ERR_GET_CERTIFICATE_FAILED Failed in getting certificate.
ERR_CLIENT_CERTIFICATE_VALIDATION The provided certificate failed server-side validation.
ERR_SERVER_CERTIFICATE_VALIDATION The server certificate failed client-side validation.
ERR_SERVER_REQUEST_FAILED (-110) Exception message reported by httpUrlConnection. The native code should contain the specific error information.
ERR_HTTP_TIMEOUT Timeout error while connecting to the server.