APIdia Launch Partner
Top Description Fields Constructors Methods
sun.net.www.protocol.https

public abstract Class AbstractDelegateHttpsURLConnection

extends HttpURLConnection
Class Inheritance
Known Direct Subclasses
sun.net.www.protocol.https.DelegateHttpsURLConnection
Imports
java.net.Authenticator, .URL, .Proxy, .SecureCacheResponse, java.security.Principal, java.security.cert.Certificate, .X509Certificate, java.io.IOException, java.util.List, .Optional, javax.net.ssl.SSLSession, .SSLPeerUnverifiedException, sun.net.www.http.*, sun.net.www.protocol.http.HttpURLConnection, .HttpCallerInfo

HTTPS URL connection support. We need this delegate because HttpsURLConnection is a subclass of java.net.HttpURLConnection. We will avoid copying over the code from sun.net.www.protocol.http.HttpURLConnection by having this class

Field Summary

Modifier and TypeField and Description
private SSLSession
Inherited from sun.net.www.protocol.http.HttpURLConnection:
authCacheauthenticatorcachedResponsehandlerhttpinstProxypsuserAgent

Constructor Summary

AccessConstructor and Description
protected
protected

Method Summary

Modifier and TypeMethod and Description
public void
connect()

Overrides sun.net.www.protocol.http.HttpURLConnection.connect.

Implements the HTTP protocol handler's "connect" method, establishing an SSL connection to the server as necessary.

public void
disconnect()

Overrides sun.net.www.protocol.http.HttpURLConnection.disconnect.

Disconnect from the server (public API)

public String
getCipherSuite()

Returns the cipher suite in use on this connection.

protected abstract HostnameVerifier
protected HttpCallerInfo
getHttpCallerInfo(URL url, String proxy, int port, Authenticator authenticator)

Overrides sun.net.www.protocol.http.HttpURLConnection.getHttpCallerInfo.

Overridden in https to also include the server certificate

protected HttpCallerInfo
getHttpCallerInfo(URL url, Authenticator authenticator)

Overrides sun.net.www.protocol.http.HttpURLConnection.getHttpCallerInfo.

Overridden in https to also include the server certificate

public Certificate[]
getLocalCertificates()

Returns the certificate chain the client sent to the server, or null if the client did not authenticate.

pack-priv Principal
getLocalPrincipal()

Returns the principal the client sent to the server, or null if the client did not authenticate.

private static Principal
getLocalPrincipal(SSLSession session)

Returns the principal the client sent to the server, or null if the client did not authenticate.

protected HttpClient
protected HttpClient
getNewHttpClient(URL url, Proxy p, int connectTimeout, boolean useCache)

Overrides sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient.

pack-priv Principal
getPeerPrincipal()

Returns the server's principal, or throws SSLPeerUnverifiedException if the server did not authenticate.

private static Principal
getPeerPrincipal(SSLSession session)

Returns the principal with which the server authenticated itself, or throw a SSLPeerUnverifiedException if the server did not authenticate.

public Certificate[]
getServerCertificates()

Returns the server's certificate chain, or throws SSLPeerUnverified Exception if the server did not authenticate.

pack-priv SSLSession
protected abstract SSLSocketFactory
public boolean
isConnected()

Used by subclass to access "connected" variable.

protected void
noResponseBody()

Overrides sun.net.www.protocol.http.HttpURLConnection.noResponseBody.

This method is called when a response with no response body is received, and arrange for the http client to be returned to the pool (or released) immediately when possible.

protected void
proxiedConnect(URL url, String proxyHost, int proxyPort, boolean useCache)

Overrides sun.net.www.protocol.http.HttpURLConnection.proxiedConnect.

private SSLSession
public void
setConnected(boolean conn)

Used by subclass to access "connected" variable.

public void
setNewClient(URL
the URL being accessed
url
)

Overrides sun.net.www.protocol.http.HttpURLConnection.setNewClient.

Create a new HttpClient object, bypassing the cache of HTTP client objects/connections.

public void
setNewClient(URL
the URL being accessed
url
,
boolean
whether the cached connection should be used if present
useCache
)

Overrides sun.net.www.protocol.http.HttpURLConnection.setNewClient.

Obtain a HttpClient object.

public void
setProxiedClient(URL
the URL being accessed
url
,
String
the proxy host to use
proxyHost
,
int
the proxy port to use
proxyPort
)

Overrides sun.net.www.protocol.http.HttpURLConnection.setProxiedClient.

Create a new HttpClient object, set up so that it uses per-instance proxying to the given HTTP proxy.

public void
setProxiedClient(URL
the URL being accessed
url
,
String
the proxy host to use
proxyHost
,
int
the proxy port to use
proxyPort
,
boolean
whether the cached connection should be used if present
useCache
)

Overrides sun.net.www.protocol.http.HttpURLConnection.setProxiedClient.

Obtain a HttpClient object, set up so that it uses per-instance proxying to the given HTTP proxy.

private boolean
Inherited from sun.net.www.protocol.http.HttpURLConnection:
addRequestPropertyauthObjauthObjdoTunnelinggetAuthCachegetConnectTimeoutgetCookieHandlergetErrorStreamgetHeaderFieldgetHeaderFieldgetHeaderFieldKeygetHeaderFieldsgetHttpLoggergetInputStreamgetOutputStreamgetReadTimeoutgetRequestPropertiesgetRequestPropertyisLockHeldByCurrentThreadplainConnectplainConnect0setAuthenticationPropertysetAuthenticatorsetConnectTimeoutsetReadTimeoutsetRequestMethodsetRequestPropertysetTunnelStatestreamingusingProxy

Field Detail

savedSessionback to summary
private SSLSession savedSession

Constructor Detail

AbstractDelegateHttpsURLConnectionback to summary
protected AbstractDelegateHttpsURLConnection(URL url, Handler handler) throws IOException
AbstractDelegateHttpsURLConnectionback to summary
protected AbstractDelegateHttpsURLConnection(URL url, Proxy p, Handler handler) throws IOException

Method Detail

connectback to summary
public void connect() throws IOException

Overrides sun.net.www.protocol.http.HttpURLConnection.connect.

Implements the HTTP protocol handler's "connect" method, establishing an SSL connection to the server as necessary.

Exceptions
IOException:

Doc from java.net.URLConnection.connect.

if an I/O error occurs while opening the connection.

disconnectback to summary
public void disconnect()

Overrides sun.net.www.protocol.http.HttpURLConnection.disconnect.

Doc from sun.net.www.protocol.http.HttpURLConnection.disconnect.

Disconnect from the server (public API)

Annotations
@Override
getCipherSuiteback to summary
public String getCipherSuite()

Returns the cipher suite in use on this connection.

getHostnameVerifierback to summary
protected abstract HostnameVerifier getHostnameVerifier()
getHttpCallerInfoback to summary
protected HttpCallerInfo getHttpCallerInfo(URL url, String proxy, int port, Authenticator authenticator)

Overrides sun.net.www.protocol.http.HttpURLConnection.getHttpCallerInfo.

Doc from sun.net.www.protocol.http.HttpURLConnection.getHttpCallerInfo.

Overridden in https to also include the server certificate

Annotations
@Override
getHttpCallerInfoback to summary
protected HttpCallerInfo getHttpCallerInfo(URL url, Authenticator authenticator)

Overrides sun.net.www.protocol.http.HttpURLConnection.getHttpCallerInfo.

Doc from sun.net.www.protocol.http.HttpURLConnection.getHttpCallerInfo.

Overridden in https to also include the server certificate

Annotations
@Override
getLocalCertificatesback to summary
public Certificate[] getLocalCertificates()

Returns the certificate chain the client sent to the server, or null if the client did not authenticate.

getLocalPrincipalback to summary
pack-priv Principal getLocalPrincipal()

Returns the principal the client sent to the server, or null if the client did not authenticate.

getLocalPrincipalback to summary
private static Principal getLocalPrincipal(SSLSession session)

Returns the principal the client sent to the server, or null if the client did not authenticate.

Parameters
session:SSLSession

The SSL session

getNewHttpClientback to summary
protected HttpClient getNewHttpClient(URL url, Proxy p, int connectTimeout) throws IOException

Overrides sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient.

getNewHttpClientback to summary
protected HttpClient getNewHttpClient(URL url, Proxy p, int connectTimeout, boolean useCache) throws IOException

Overrides sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient.

getPeerPrincipalback to summary
pack-priv Principal getPeerPrincipal() throws SSLPeerUnverifiedException

Returns the server's principal, or throws SSLPeerUnverifiedException if the server did not authenticate.

getPeerPrincipalback to summary
private static Principal getPeerPrincipal(SSLSession session) throws SSLPeerUnverifiedException

Returns the principal with which the server authenticated itself, or throw a SSLPeerUnverifiedException if the server did not authenticate.

Parameters
session:SSLSession

The SSL session

getServerCertificatesback to summary
public Certificate[] getServerCertificates() throws SSLPeerUnverifiedException

Returns the server's certificate chain, or throws SSLPeerUnverified Exception if the server did not authenticate.

getSSLSessionback to summary
pack-priv SSLSession getSSLSession()
getSSLSocketFactoryback to summary
protected abstract SSLSocketFactory getSSLSocketFactory()
isConnectedback to summary
public boolean isConnected()

Used by subclass to access "connected" variable.

noResponseBodyback to summary
protected void noResponseBody()

Overrides sun.net.www.protocol.http.HttpURLConnection.noResponseBody.

Doc from sun.net.www.protocol.http.HttpURLConnection.noResponseBody.

This method is called when a response with no response body is received, and arrange for the http client to be returned to the pool (or released) immediately when possible.

Annotations
@Override
proxiedConnectback to summary
protected void proxiedConnect(URL url, String proxyHost, int proxyPort, boolean useCache) throws IOException

Overrides sun.net.www.protocol.http.HttpURLConnection.proxiedConnect.

sessionback to summary
private SSLSession session()
setConnectedback to summary
public void setConnected(boolean conn)

Used by subclass to access "connected" variable.

setNewClientback to summary
public void setNewClient(URL url) throws IOException

Overrides sun.net.www.protocol.http.HttpURLConnection.setNewClient.

Create a new HttpClient object, bypassing the cache of HTTP client objects/connections.

Parameters
url:URL

the URL being accessed

setNewClientback to summary
public void setNewClient(URL url, boolean useCache) throws IOException

Overrides sun.net.www.protocol.http.HttpURLConnection.setNewClient.

Obtain a HttpClient object. Use the cached copy if specified.

Parameters
url:URL

the URL being accessed

useCache:boolean

whether the cached connection should be used if present

setProxiedClientback to summary
public void setProxiedClient(URL url, String proxyHost, int proxyPort) throws IOException

Overrides sun.net.www.protocol.http.HttpURLConnection.setProxiedClient.

Create a new HttpClient object, set up so that it uses per-instance proxying to the given HTTP proxy. This bypasses the cache of HTTP client objects/connections.

Parameters
url:URL

the URL being accessed

proxyHost:String

the proxy host to use

proxyPort:int

the proxy port to use

setProxiedClientback to summary
public void setProxiedClient(URL url, String proxyHost, int proxyPort, boolean useCache) throws IOException

Overrides sun.net.www.protocol.http.HttpURLConnection.setProxiedClient.

Obtain a HttpClient object, set up so that it uses per-instance proxying to the given HTTP proxy. Use the cached copy of HTTP client objects/connections if specified.

Parameters
url:URL

the URL being accessed

proxyHost:String

the proxy host to use

proxyPort:int

the proxy port to use

useCache:boolean

whether the cached connection should be used if present

useExtendedCallerInfoback to summary
private boolean useExtendedCallerInfo(URL url)