Class AbstractStreamProvider
java.lang.Object
org.apache.catalina.tribes.membership.cloud.AbstractStreamProvider
- All Implemented Interfaces:
StreamProvider
- Direct Known Subclasses:
CertificateStreamProvider, InsecureStreamProvider, TokenStreamProvider
Abstract base class for
StreamProvider implementations that provide common functionality for opening
connections and streams.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final TrustManager[]Insecure trust managers that accept all certificates.protected static final StringManagerThe string manager for this package. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedConstructs a new AbstractStreamProvider. -
Method Summary
Modifier and TypeMethodDescriptionprotected static TrustManager[]configureCaCert(String caCertFile) Configures trust managers using the specified CA certificate file.protected abstract SSLSocketFactoryReturns the SSL socket factory.openConnection(String url, Map<String, String> headers, int connectTimeout, int readTimeout) Open URL connection to the specified URL.openStream(String url, Map<String, String> headers, int connectTimeout, int readTimeout) Opens an input stream to the specified URL.
-
Field Details
-
sm
The string manager for this package. -
INSECURE_TRUST_MANAGERS
Insecure trust managers that accept all certificates.
-
-
Constructor Details
-
AbstractStreamProvider
protected AbstractStreamProvider()Constructs a new AbstractStreamProvider.
-
-
Method Details
-
getSocketFactory
Returns the SSL socket factory.- Returns:
- the socket factory, or null if not needed
-
openConnection
public URLConnection openConnection(String url, Map<String, String> headers, int connectTimeout, int readTimeout) throws IOExceptionOpen URL connection to the specified URL.- Parameters:
url- the urlheaders- the headers mapconnectTimeout- connection timeout in msreadTimeout- read timeout in ms- Returns:
- the URL connection
- Throws:
IOException- when an error occurs
-
openStream
public InputStream openStream(String url, Map<String, String> headers, int connectTimeout, int readTimeout) throws IOExceptionOpens an input stream to the specified URL.- Specified by:
openStreamin interfaceStreamProvider- Parameters:
url- the urlheaders- the headers mapconnectTimeout- connection timeout in msreadTimeout- read timeout in ms- Returns:
- the input stream
- Throws:
IOException- when an error occurs
-
configureCaCert
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:
Exception- if an error occurs
-