Class AbstractStreamProvider

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected static javax.net.ssl.TrustManager[] INSECURE_TRUST_MANAGERS
      Insecure trust managers that accept all certificates.
      protected static StringManager sm
      The string manager for this package.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected AbstractStreamProvider()
      Constructs a new AbstractStreamProvider.
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      protected static javax.net.ssl.TrustManager[] configureCaCert​(java.lang.String caCertFile)
      Configures trust managers using the specified CA certificate file.
      protected abstract javax.net.ssl.SSLSocketFactory getSocketFactory()
      Returns the SSL socket factory.
      java.net.URLConnection openConnection​(java.lang.String url, java.util.Map<java.lang.String,​java.lang.String> headers, int connectTimeout, int readTimeout)
      Open URL connection to the specified URL.
      java.io.InputStream openStream​(java.lang.String url, java.util.Map<java.lang.String,​java.lang.String> headers, int connectTimeout, int readTimeout)
      Opens an input stream to the specified URL.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • sm

        protected static final StringManager sm
        The string manager for this package.
      • INSECURE_TRUST_MANAGERS

        protected static final javax.net.ssl.TrustManager[] INSECURE_TRUST_MANAGERS
        Insecure trust managers that accept all certificates.
    • Constructor Detail

      • AbstractStreamProvider

        protected AbstractStreamProvider()
        Constructs a new AbstractStreamProvider.
    • Method Detail

      • getSocketFactory

        protected abstract javax.net.ssl.SSLSocketFactory getSocketFactory()
        Returns the SSL socket factory.
        Returns:
        the socket factory, or null if not needed. Implementations that may open HTTPS connections must not return null since the returned factory is applied unconditionally to HTTPS connections by openStream(String, Map, int, int).
      • openConnection

        public java.net.URLConnection openConnection​(java.lang.String url,
                                                     java.util.Map<java.lang.String,​java.lang.String> headers,
                                                     int connectTimeout,
                                                     int readTimeout)
                                              throws java.io.IOException
        Open URL connection to the specified URL.
        Parameters:
        url - the url
        headers - the headers map
        connectTimeout - connection timeout in ms
        readTimeout - read timeout in ms
        Returns:
        the URL connection
        Throws:
        java.io.IOException - when an error occurs
      • openStream

        public java.io.InputStream openStream​(java.lang.String url,
                                              java.util.Map<java.lang.String,​java.lang.String> headers,
                                              int connectTimeout,
                                              int readTimeout)
                                       throws java.io.IOException
        Opens an input stream to the specified URL.
        Specified by:
        openStream in interface StreamProvider
        Parameters:
        url - the url
        headers - the headers map
        connectTimeout - connection timeout in ms
        readTimeout - read timeout in ms
        Returns:
        the input stream
        Throws:
        java.io.IOException - when an error occurs
      • configureCaCert

        protected static javax.net.ssl.TrustManager[] configureCaCert​(java.lang.String caCertFile)
                                                               throws java.lang.Exception
        Configures trust managers using the specified CA certificate file.
        Parameters:
        caCertFile - the path to the CA certificate file
        Returns:
        an array of trust managers
        Throws:
        java.lang.Exception - if an error occurs