HttpsURLConnection
extends HttpURLConnection
with support for https-specific features.
See http://www.w3.org/pub/WWW/Protocols/ and RFC 2818 for more details on the https specification.
This class uses HostnameVerifier
and
SSLSocketFactory
.
There are default implementations defined for both classes.
However, the implementations can be replaced on a per-class (static) or
per-instance basis. All new HttpsURLConnection
s instances
will be assigned
the "default" static values at instance creation, but they can be overridden
by calling the appropriate per-instance set method(s) before
connect
ing.
Modifier and Type | Class and Description |
---|---|
private static class |
Modifier and Type | Field and Description |
---|---|
private static HostnameVerifier | defaultHostnameVerifier
|
private static SSLSocketFactory | |
protected HostnameVerifier | hostnameVerifier
The |
private SSLSocketFactory | sslSocketFactory
The |
Access | Constructor and Description |
---|---|
protected |
Modifier and Type | Method and Description |
---|---|
public abstract String | |
public static HostnameVerifier | Returns: the default host name verifierGets the default |
public static SSLSocketFactory | Returns: the defaultSSLSocketFactory Gets the default static |
public HostnameVerifier | Returns: the host name verifierGets the |
public abstract Certificate[] | Returns: an ordered array of certificates, with the client's own certificate first followed by any certificate authorities. If no certificates were sent, then null is returned.Returns the certificate(s) that were sent to the server during handshaking. |
public Principal | Returns: the principal sent to the server. Returns an X500Principal of the end-entity certificate for X509-based cipher suites, and KerberosPrincipal for Kerberos cipher suites. If no principal was sent, then null is returned.Returns the principal that was sent to the server during handshaking. |
public Principal | Returns: the server's principal. Returns an X500Principal of the end-entity certificate for X509-based cipher suites, and KerberosPrincipal for Kerberos cipher suites.Returns the server's principal which was established as part of defining the session. |
public abstract Certificate[] | Returns: an ordered array of server certificates, with the peer's own certificate first followed by any certificate authorities.Returns the server's certificate chain which was established as part of defining the session. |
public Optional | |
public SSLSocketFactory | Returns: theSSLSocketFactory Gets the SSL socket factory to be used when creating sockets for secure https URL connections. |
public static void | setDefaultHostnameVerifier(HostnameVerifier
the default host name verifier v)Sets the default |
public static void | setDefaultSSLSocketFactory(SSLSocketFactory
the default SSL socket factory sf)Sets the default |
public void | setHostnameVerifier(HostnameVerifier
the host name verifier v)Sets the |
public void | setSSLSocketFactory(SSLSocketFactory
the SSL socket factory sf)Sets the |
defaultHostnameVerifier | back to summary |
---|---|
private static HostnameVerifier defaultHostnameVerifier
The default implementation will deny such connections. |
defaultSSLSocketFactory | back to summary |
---|---|
private static SSLSocketFactory defaultSSLSocketFactory |
hostnameVerifier | back to summary |
---|---|
protected HostnameVerifier hostnameVerifier The |
sslSocketFactory | back to summary |
---|---|
private SSLSocketFactory sslSocketFactory The |
HttpsURLConnection | back to summary |
---|---|
protected HttpsURLConnection(URL url) Creates an
|
getCipherSuite | back to summary |
---|---|
public abstract String getCipherSuite() Returns the cipher suite in use on this connection.
|
getDefaultHostnameVerifier | back to summary |
---|---|
public static HostnameVerifier getDefaultHostnameVerifier() Gets the default
|
getDefaultSSLSocketFactory | back to summary |
---|---|
public static SSLSocketFactory getDefaultSSLSocketFactory() Gets the default static The socket factories are used when creating sockets for secure https URL connections.
|
getHostnameVerifier | back to summary |
---|---|
public HostnameVerifier getHostnameVerifier() Gets the
|
getLocalCertificates | back to summary |
---|---|
public abstract Certificate[] getLocalCertificates() Returns the certificate(s) that were sent to the server during handshaking. Note This method is useful only when using certificate-based cipher suites. When multiple certificates are available for use in a handshake, the implementation chooses what it considers the "best" certificate chain available, and transmits that to the other side. This method allows the caller to know which certificate chain was actually sent.
|
getLocalPrincipal | back to summary |
---|---|
public Principal getLocalPrincipal() Returns the principal that was sent to the server during handshaking. Note Subclasses should override this method. If not overridden, it will default to returning the X500Principal of the end-entity certificate that was sent to the server for certificate-based ciphersuites or, return null for non-certificate based ciphersuites, such as Kerberos.
|
getPeerPrincipal | back to summary |
---|---|
public Principal getPeerPrincipal() throws SSLPeerUnverifiedException Returns the server's principal which was established as part of defining the session. Note Subclasses should override this method. If not overridden, it will default to returning the X500Principal of the server's end-entity certificate for certificate-based ciphersuites, or throw an SSLPeerUnverifiedException for non-certificate based ciphersuites, such as Kerberos.
|
getServerCertificates | back to summary |
---|---|
public abstract Certificate[] getServerCertificates() throws SSLPeerUnverifiedException Returns the server's certificate chain which was established as part of defining the session. Note This method can be used only when using certificate-based cipher suites; using it with non-certificate-based cipher suites, such as Kerberos, will throw an SSLPeerUnverifiedException. Note The returned value may not be a valid certificate chain and should not be relied on for trust decisions.
|
getSSLSession | back to summary |
---|---|
public Optional Returns an Implementation Specification For compatibility, the default implementation of this
method returns an empty
|
getSSLSocketFactory | back to summary |
---|---|
public SSLSocketFactory getSSLSocketFactory() Gets the SSL socket factory to be used when creating sockets for secure https URL connections.
|
setDefaultHostnameVerifier | back to summary |
---|---|
public static void setDefaultHostnameVerifier(HostnameVerifier v) Sets the default
If this method is not called, the default
|
setDefaultSSLSocketFactory | back to summary |
---|---|
public static void setDefaultSSLSocketFactory(SSLSocketFactory sf) Sets the default The socket factories are used when creating sockets for secure https URL connections.
|
setHostnameVerifier | back to summary |
---|---|
public void setHostnameVerifier(HostnameVerifier v) Sets the
New instances of this class inherit the default static hostname
verifier set by
|
setSSLSocketFactory | back to summary |
---|---|
public void setSSLSocketFactory(SSLSocketFactory sf) Sets the
New instances of this class inherit the default static
|
Access | Constructor and Description |
---|---|
private |
Modifier and Type | Method and Description |
---|---|
public boolean | verify(String
the host name hostname, SSLSession SSLSession used on the connection to host session)Implements javax. Verify that the host name is an acceptable match with the server's authentication scheme. |
DefaultHostnameVerifier | back to summary |
---|---|
private DefaultHostnameVerifier() |
verify | back to summary |
---|---|
public boolean verify(String hostname, SSLSession session) Implements javax. Doc from javax. Verify that the host name is an acceptable match with the server's authentication scheme.
|