HostnameVerifier


HostnameVerifier javax.net.ssl

Java 1.4

An object that implements this interface may be used with an HttpsURLConnection object to handle the case in which the hostname that appears in the URL does not match the hostname obtained during the SSL handshake with the server. This occurs, for example, when a website uses the secure certificate of its parent web hosting company, for example. In this situation, the verify( ) method of the HostnameVerifier is called to determine whether the connection should proceed or not. verify( ) should return true to allow the connection to proceed, and should return false to cause the connection to fail. The hostname argument to verify( ) specifies the hostname that appeared in the URL. The session argument specifies the SSLSession object that was established during the handshake. Call getPeerHost( ) on this object to determine the hostname reported during server authentication. If no HostnameVerifier is registered with a HttpsURLConnection object, and no default verifier is registered with the HttpsURLConnection class, then hostname mismatches will always cause the connection to fail. In user -driven applications such as web browsers, a HostnameVerifier can be used to ask the user whether to proceed or not.

 public interface  HostnameVerifier  {  // Public Instance Methods  boolean  verify  (String  hostname  , SSLSession  session  );   } 

Passed To

HttpsURLConnection.{setDefaultHostnameVerifier( ) , setHostnameVerifier( )}

Returned By

HttpsURLConnection.{getDefaultHostnameVerifier( ) , getHostnameVerifier( )}

Type Of

HttpsURLConnection.hostnameVerifier



Java In A Nutshell
Java In A Nutshell, 5th Edition
ISBN: 0596007736
EAN: 2147483647
Year: 2004
Pages: 1220

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net