com.jscape.inet.https

## Class Https

- java.lang.Object
- - com.jscape.inet.http.Http
  - - com.jscape.inet.https.Https

- All Implemented Interfaces:
    java.io.Serializable

      public class Https
      extends Http

  Implements the basic functionality of a HTTPS client. This class extends the Http class therefore providing all the same functionality but for SSL connections. See the com.jscape.inet.http package for more information. Use of this class requires JDK 1.4 or JDK 1.3.x and the JCE (Java Cryptography Extensions). The JCE may be downloaded from http://java.sun.com/products/archive/jce/1.2/

  When using JDK 1.3.x and JCE be sure to place the JCE jar files (jcert.jar, jnet.jar and jsse.jar) in your JDK_HOME/lib/jre/ext directory.

  JDK 1.4 and greater Example Usage:

       Https https = new Https();

       // build HTTP request
       HttpRequest request = new HttpRequest("https://www.myserver.com");

       // get HTTP response
       try {
         HttpResponse response = https.getResponse(request);
         System.out.println(response.getBody());
       }
       catch(Exception e) {
         System.out.println(e);
       }

  JDK 1.3.x with JCE Example Usage:

       Https https = new Https();

       // register SSL provider
       javax.security.Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());
        // build HTTP request
       HttpRequest request = new HttpRequest("https://www.myserver.com");

       // get HTTP response
       try {
         HttpResponse response = https.getResponse(request);
         System.out.println(response.getBody());
       }
       catch(Exception e) {
         System.out.println(e);
       }

  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `Https()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addHandshakeCompletedListener(javax.net.ssl.HandshakeCompletedListener listener)` Adds an event listener for events implemented by HandShakeCompletedListener interface.
    `javax.net.ssl.SSLSession` | `getSession()` Gets information about SSL session
    `javax.net.ssl.SSLSocketFactory` | `getSSLSocketFactory()` Gets SSLSocketFactory used in establishing an SSL (Secure Sockets Layer) connection
    `void` | `removeHandshakeCompletedListener(javax.net.ssl.HandshakeCompletedListener listener)` Removes instance of HandshakeCompletedListener
    `void` | `setClientCertificates(java.lang.String filename, java.lang.String password)` Sets optional client certificate to be used during authentication.
    `void` | `setClientCertificates(java.lang.String filename, java.lang.String password, java.lang.String storetype)` Sets optional client certificate to be used during authentication.
    `void` | `setServerCertificates(java.lang.String filename, java.lang.String password)` Sets optional server certificate to be used during authentication.
    `void` | `setServerCertificates(java.lang.String filename, java.lang.String password, java.lang.String storetype)` Sets optional server certificate to be used during authentication.
    `void` | `setSSLSocketFactory(javax.net.ssl.SSLSocketFactory factory)` Sets SSLSocketFactory to be used in establishing a SSL connection

    - ### Methods inherited from class com.jscape.inet.http.Http

      `addHttpListener, clearProxySettings, getDebugStream, getMaxDataSize, getReadBlockSize, getResponse, getResponse, getResponseToFile, getTimeout, getWriteBlockSize, isDebug, removeHttpListener, setDebug, setDebugStream, setMaxDataSize, setProxyAuthentication, setProxyHost, setProxyType, setReadBlockSize, setTimeout, setWriteBlockSize`

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### Https

          public Https()

  - ### Method Detail

    - #### getSession

          public javax.net.ssl.SSLSession getSession()

      Gets information about SSL session
      Returns:
        a SSLSession
      See Also:
        `SSLSession`

    - #### addHandshakeCompletedListener

          public void addHandshakeCompletedListener(javax.net.ssl.HandshakeCompletedListener listener)

      Adds an event listener for events implemented by HandShakeCompletedListener interface.
      Parameters:
        `listener` - a `HandShakeCompletedListener`

    - #### removeHandshakeCompletedListener

          public void removeHandshakeCompletedListener(javax.net.ssl.HandshakeCompletedListener listener)

      Removes instance of HandshakeCompletedListener
      Parameters:
        `listener` - the HandshakeCompletedListener
      See Also:
        `HandshakeCompletedListener`

    - #### setSSLSocketFactory

          public void setSSLSocketFactory(javax.net.ssl.SSLSocketFactory factory)

      Sets SSLSocketFactory to be used in establishing a SSL connection
      Parameters:
        `factory` - a `SSLSocketFactory`
      See Also:
        `SSLSocketFactory`

    - #### getSSLSocketFactory

          public javax.net.ssl.SSLSocketFactory getSSLSocketFactory()

      Gets SSLSocketFactory used in establishing an SSL (Secure Sockets Layer) connection
      Returns:
        a `SSLSocketFactory`
      See Also:
        `SSLSocketFactory`

    - #### setServerCertificates

          public void setServerCertificates(java.lang.String filename,
                                            java.lang.String password)
                                     throws HttpException

      Sets optional server certificate to be used during authentication. Default expected keystore format is JKS format. Existing certificate may be imported into keystore using the `keytool` utility provided in the Sun JDK.

      Example:

           keytool.exe -import -file x509.cer -keystore your_store_name

      The example above imports the certificate x509.cer into a keystore named your_store_name

      Parameters:
        `filename` - the keystore file containing the server certificate
        `password` - the keystore password
      Throws:
        `HttpException` - if certificates cannot be loaded

    - #### setServerCertificates

          public void setServerCertificates(java.lang.String filename,
                                            java.lang.String password,
                                            java.lang.String storetype)
                                     throws HttpException

      Sets optional server certificate to be used during authentication. Default expected keystore format is JKS format. Existing certificate may be imported into keystore using the `keytool` utility provided in the Sun JDK.

      Example:

           keytool.exe -import -file x509.cer -keystore your_store_name

      The example above imports the certificate x509.cer into a keystore named your_store_name

      Parameters:
        `filename` - the keystore file containing the server certificate
        `password` - the keystore password
        `storetype` - the keystore type valid values include jks and pkcs12
      Throws:
        `HttpException` - if certificates cannot be loaded

    - #### setClientCertificates

          public void setClientCertificates(java.lang.String filename,
                                            java.lang.String password)
                                     throws HttpException

      Sets optional client certificate to be used during authentication. Default expected keystore format is JKS format. Existing certificate may be imported into keystore using the `keytool` utility provided in the Sun JDK.

      Example:

           keytool.exe -import -file x509.cer -keystore your_store_name

      The example above imports the certificate x509.cer into a keystore named your_store_name

      Parameters:
        `filename` - the keystore file containing the client certificate
        `password` - the keystore password
      Throws:
        `HttpException` - if certificates cannot be loaded

    - #### setClientCertificates

          public void setClientCertificates(java.lang.String filename,
                                            java.lang.String password,
                                            java.lang.String storetype)
                                     throws HttpException

      Sets optional client certificate to be used during authentication. Default expected keystore format is JKS format. Existing certificate may be imported into keystore using the `keytool` utility provided in the Sun JDK.

      Example:

           keytool.exe -import -file x509.cer -keystore your_store_name

      The example above imports the certificate x509.cer into a keystore named your_store_name

      Parameters:
        `filename` - the keystore file containing the client certificate
        `password` - the keystore password
        `storetype` - the keystore type valid values include jks and pkcs12
      Throws:
        `HttpException` - if certificate cannot be loaded

Copyright © JSCAPE LLC. 1999-2021. All Rights Reserved