| java.lang.Object org.apache.commons.httpclient.contrib.ssl.StrictSSLProtocolSocketFactory
StrictSSLProtocolSocketFactory | public class StrictSSLProtocolSocketFactory implements SecureProtocolSocketFactory(Code) | | A SecureProtocolSocketFactory that uses JSSE to create
SSL sockets. It will also support host name verification to help preventing
man-in-the-middle attacks. Host name verification is turned on by
default but one will be able to turn it off, which might be a useful feature
during development. Host name verification will make sure the SSL sessions
server host name matches with the the host name returned in the
server certificates "Common Name" field of the "SubjectDN" entry.
author: Sebastian Hauer author: author: DISCLAIMER: HttpClient developers DO NOT actively support this component. author: The component is provided as a reference material, which may be inappropriate author: for use without additional customization. author:
|
Method Summary | |
public Socket | createSocket(String host, int port, InetAddress clientHost, int clientPort) | public Socket | createSocket(String host, int port, InetAddress localAddress, int localPort, HttpConnectionParams params) Attempts to get a new socket connection to the given host within the given time limit.
This method employs several techniques to circumvent the limitations of older JREs that
do not support connect timeout. | public Socket | createSocket(String host, int port) | public Socket | createSocket(Socket socket, String host, int port, boolean autoClose) | public boolean | equals(Object obj) | public boolean | getHostnameVerification() Gets the status of the host name verification flag.
Host name verification flag. | public int | hashCode() | public void | setHostnameVerification(boolean verifyHostname) Set the host name verification flag.
Parameters: verifyHostname - The host name verification flag. |
StrictSSLProtocolSocketFactory | public StrictSSLProtocolSocketFactory(boolean verifyHostname)(Code) | | Constructor for StrictSSLProtocolSocketFactory.
Parameters: verifyHostname - The host name verification flag. If set to true the SSL sessions server host name will be comparedto the host name returned in the server certificates "Common Name" field of the "SubjectDN" entry. If these names do not match aException is thrown to indicate this. Enabling host name verification will help to prevent from man-in-the-middle attacks. If set to false host name verification is turned off.Code sample:Protocol stricthttps = new Protocol( "https", new StrictSSLProtocolSocketFactory(true), 443);HttpClient client = new HttpClient();client.getHostConfiguration().setHost("localhost", 443, stricthttps); |
StrictSSLProtocolSocketFactory | public StrictSSLProtocolSocketFactory()(Code) | | Constructor for StrictSSLProtocolSocketFactory.
Host name verification will be enabled by default.
|
createSocket | public Socket createSocket(String host, int port, InetAddress localAddress, int localPort, HttpConnectionParams params) throws IOException, UnknownHostException, ConnectTimeoutException(Code) | | Attempts to get a new socket connection to the given host within the given time limit.
This method employs several techniques to circumvent the limitations of older JREs that
do not support connect timeout. When running in JRE 1.4 or above reflection is used to
call Socket#connect(SocketAddress endpoint, int timeout) method. When executing in older
JREs a controller thread is executed. The controller thread attempts to create a new socket
within the given limit of time. If socket constructor does not return until the timeout
expires, the controller terminates and throws an
ConnectTimeoutException
Parameters: host - the host name/IP Parameters: port - the port on the host Parameters: clientHost - the local host name/IP to bind the socket to Parameters: clientPort - the port on the local machine Parameters: params - HttpConnectionParams Http connection parameters Socket a new socket throws: IOException - if an I/O error occurs while creating the socket throws: UnknownHostException - if the IP address of the host cannot bedetermined |
getHostnameVerification | public boolean getHostnameVerification()(Code) | | Gets the status of the host name verification flag.
Host name verification flag. Either true if hostname verification is turned on, or false if host nameverification is turned off. |
hashCode | public int hashCode()(Code) | | |
setHostnameVerification | public void setHostnameVerification(boolean verifyHostname)(Code) | | Set the host name verification flag.
Parameters: verifyHostname - The host name verification flag. If set to true the SSL sessions server host name will be comparedto the host name returned in the server certificates "Common Name" field of the "SubjectDN" entry. If these names do not match aException is thrown to indicate this. Enabling host name verification will help to prevent from man-in-the-middle attacks. If set to false host name verification is turned off. |
|
|