public class Https extends Http
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);
}
| Constructor and Description |
|---|
Https() |
| 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
|
addHttpListener, clearProxySettings, getDebugStream, getMaxDataSize, getReadBlockSize, getResponse, getResponse, getResponseToFile, getTimeout, getWriteBlockSize, isDebug, removeHttpListener, setDebug, setDebugStream, setMaxDataSize, setProxyAuthentication, setProxyHost, setProxyType, setReadBlockSize, setTimeout, setWriteBlockSizepublic javax.net.ssl.SSLSession getSession()
SSLSessionpublic void addHandshakeCompletedListener(javax.net.ssl.HandshakeCompletedListener listener)
listener - a HandShakeCompletedListenerpublic void removeHandshakeCompletedListener(javax.net.ssl.HandshakeCompletedListener listener)
listener - the HandshakeCompletedListenerHandshakeCompletedListenerpublic void setSSLSocketFactory(javax.net.ssl.SSLSocketFactory factory)
factory - a SSLSocketFactorySSLSocketFactorypublic javax.net.ssl.SSLSocketFactory getSSLSocketFactory()
SSLSocketFactorySSLSocketFactorypublic void setServerCertificates(java.lang.String filename,
java.lang.String password)
throws HttpException
keytool utility provided in the Sun JDK.
Example:
keytool.exe -import -file x509.cer -keystore your_store_nameThe example above imports the certificate x509.cer into a keystore named your_store_name
filename - the keystore file containing the server certificatepassword - the keystore passwordHttpException - if certificates cannot be loadedpublic void setServerCertificates(java.lang.String filename,
java.lang.String password,
java.lang.String storetype)
throws HttpException
keytool utility provided in the Sun JDK.
Example:
keytool.exe -import -file x509.cer -keystore your_store_nameThe example above imports the certificate x509.cer into a keystore named your_store_name
filename - the keystore file containing the server certificatepassword - the keystore passwordstoretype - the keystore type valid values include jks and pkcs12HttpException - if certificates cannot be loadedpublic void setClientCertificates(java.lang.String filename,
java.lang.String password)
throws HttpException
keytool utility provided in the Sun JDK.
Example:
keytool.exe -import -file x509.cer -keystore your_store_nameThe example above imports the certificate x509.cer into a keystore named your_store_name
filename - the keystore file containing the client certificatepassword - the keystore passwordHttpException - if certificates cannot be loadedpublic void setClientCertificates(java.lang.String filename,
java.lang.String password,
java.lang.String storetype)
throws HttpException
keytool utility provided in the Sun JDK.
Example:
keytool.exe -import -file x509.cer -keystore your_store_nameThe example above imports the certificate x509.cer into a keystore named your_store_name
filename - the keystore file containing the client certificatepassword - the keystore passwordstoretype - the keystore type valid values include jks and pkcs12HttpException - if certificate cannot be loadedCopyright © JSCAPE LLC. 1999-2021. All Rights Reserved