Prev Class | Next Class | Frames | No Frames |
Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
java.lang.Object
java.net.URLConnection
java.net.HttpURLConnection
javax.net.ssl.HttpsURLConnection
public abstract class HttpsURLConnection
extends HttpURLConnection
This class may be used in the same way as HttpURLConnection
, and it will transparently negotiate the SSL
connection.
Field Summary | |
protected HostnameVerifier |
|
Fields inherited from class java.net.URLConnection | |
allowUserInteraction , connected , doInput , doOutput , ifModifiedSince , url , useCaches |
Constructor Summary | |
|
Method Summary | |
abstract String |
|
static HostnameVerifier |
|
static SSLSocketFactory |
|
HostnameVerifier |
|
abstract Certificate[] |
|
Principal |
|
Principal |
|
SSLSocketFactory |
|
abstract Certificate[] |
|
static void |
|
static void |
|
void |
|
void |
|
Methods inherited from class java.net.HttpURLConnection | |
disconnect , getErrorStream , getFollowRedirects , getHeaderFieldDate , getInstanceFollowRedirects , getPermission , getRequestMethod , getResponseCode , getResponseMessage , setFollowRedirects , setInstanceFollowRedirects , setRequestMethod , usingProxy |
Methods inherited from class java.lang.Object | |
clone , equals , extends Object> getClass , finalize , hashCode , notify , notifyAll , toString , wait , wait , wait |
protected HostnameVerifier hostnameVerifier
The hostname verifier used for this connection.
protected HttpsURLConnection(URL url)
Creates a new HTTPS URL connection.
- Parameters:
url
- The URL of the connection being established.
public abstract String getCipherSuite()
Returns the cipher name negotiated for this connection.
- Returns:
- The cipher name.
- Throws:
IllegalStateException
- If the connection has not yet been established.
public static HostnameVerifier getDefaultHostnameVerifier()
Returns the default hostname verifier used in all new connections. If the default verifier has not been set, a new default one will be provided by this method.
- Returns:
- The default hostname verifier.
public static SSLSocketFactory getDefaultSSLSocketFactory()
Returns the default SSL socket factory used in all new connections. If the default SSL socket factory has not been set, a new default one will be provided by this method.
- Returns:
- The default SSL socket factory.
public HostnameVerifier getHostnameVerifier()
Returns the current hostname verifier for this instance.
- Returns:
- The hostname verifier.
public abstract Certificate[] getLocalCertificates()
Returns the certificates used on the local side in this connection.
- Returns:
- The local certificates.
- Throws:
IllegalStateException
- If the connection has not yet been established.
public Principal getLocalPrincipal()
Returns the local principal for this connection.The default implementation will return the
javax.security.x500.X500Principal
for the end entity certificate in the local certificate chain if those certificates are of typeX509Certificate
. Otherwise, this method returnsnull
.
- Returns:
- The local principal.
- Since:
- 1.5
public Principal getPeerPrincipal() throws SSLPeerUnverifiedException
Returns the remote peer's principal for this connection.The default implementation will return the
javax.security.x500.X500Principal
for the end entity certificate in the remote peer's certificate chain if those certificates are of typeX509Certificate
. Otherwise, this method returnsnull
.
- Returns:
- The remote principal.
- Throws:
SSLPeerUnverifiedException
- If the remote peer has not been verified.
- Since:
- 1.5
public SSLSocketFactory getSSLSocketFactory()
Returns the current SSL socket factory for this instance.
- Returns:
- The current SSL socket factory.
public abstract Certificate[] getServerCertificates() throws SSLPeerUnverifiedException
Returns the certificates sent by the other party.
- Returns:
- The peer's certificates.
- Throws:
IllegalStateException
- If the connection has not yet been established.SSLPeerUnverifiedException
- If the peer could not be verified.
public static void setDefaultHostnameVerifier(HostnameVerifier newDefault)
Sets the default hostname verifier to be used in all new connections.
- Parameters:
newDefault
- The new default hostname verifier.
- Throws:
IllegalArgumentException
- If newDefault is null.SecurityException
- If there is a security manager currently installed and the caller does not have theSSLPermission
"setHostnameVerifier".
public static void setDefaultSSLSocketFactory(SSLSocketFactory newDefault)
Sets the default SSL socket factory to be used in all new connections.
- Parameters:
newDefault
- The new socket factory.
- Throws:
IllegalArgumentException
- If newDefault is null.SecurityException
- If there is a security manager installed and a call toSecurityManager.checkSetFactory()
fails.
public void setHostnameVerifier(HostnameVerifier hostnameVerifier)
Sets the hostname verifier for this instance.
- Parameters:
hostnameVerifier
- The new verifier.
- Throws:
IllegalArgumentException
- If hostnameVerifier is null.
public void setSSLSocketFactory(SSLSocketFactory factory)
Sets the SSL socket factory for this instance.
- Parameters:
factory
- The new factory.
- Throws:
IllegalArgumentException
- If factory is null.