|
Secure iNet Factory | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.jscape.inet.http.Http
com.jscape.inet.https.Https
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);
}
| Constructor Summary | |
Https()
|
|
| Method Summary | |
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, getReadBlockSize, getResponse, getResponseToFile, getTimeout, getWriteBlockSize, isDebug, removeHttpListener, setDebug, setDebugStream, setProxyAuthentication, setProxyHost, setProxyType, setReadBlockSize, setTimeout, setWriteBlockSize |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public Https()
| Method Detail |
public 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()
SSLSocketFactorySSLSocketFactory
public 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_name
The example above imports the certificate x509.cer into a keystore named your_store_name
filename - the keystore file containing the server certificatepassword - the keystore password
HttpException - if certificates cannot be loaded
public 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_name
The 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 pkcs12
HttpException - if certificates cannot be loaded
public 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_name
The example above imports the certificate x509.cer into a keystore named your_store_name
filename - the keystore file containing the client certificatepassword - the keystore password
HttpException - if certificates cannot be loaded
public 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_name
The 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 pkcs12
HttpException - if certificate cannot be loaded
|
Secure iNet Factory | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||