renamed interface SecureSocketFactory to LayeredSocketFactory
git-svn-id: https://svn.apache.org/repos/asf/jakarta/httpcomponents/httpclient/trunk@580615 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
e033a99de3
commit
25a9063286
|
@ -36,14 +36,14 @@ import java.net.Socket;
|
|||
import java.net.UnknownHostException;
|
||||
|
||||
/**
|
||||
* A {@link SocketFactory SocketFactory} for secure sockets (SSL/TLS).
|
||||
* A {@link SocketFactory SocketFactory} for layered sockets (SSL/TLS).
|
||||
* See there for things to consider when implementing a socket factory.
|
||||
*
|
||||
* @author Michael Becke
|
||||
* @author <a href="mailto:mbowler@GargoyleSoftware.com">Mike Bowler</a>
|
||||
* @since 4.0
|
||||
*/
|
||||
public interface SecureSocketFactory extends SocketFactory {
|
||||
public interface LayeredSocketFactory extends SocketFactory {
|
||||
|
||||
/**
|
||||
* Returns a socket connected to the given host that is layered over an
|
|
@ -103,7 +103,7 @@ public final class Scheme {
|
|||
this.name = name.toLowerCase();
|
||||
this.socketFactory = factory;
|
||||
this.defaultPort = port;
|
||||
this.layered = (factory instanceof SecureSocketFactory);
|
||||
this.layered = (factory instanceof LayeredSocketFactory);
|
||||
}
|
||||
|
||||
|
||||
|
@ -120,7 +120,7 @@ public final class Scheme {
|
|||
/**
|
||||
* Obtains the socket factory.
|
||||
* If this scheme is {@link #isLayered layered}, the factory implements
|
||||
* {@link SecureSocketFactory SecureSocketFactory}.
|
||||
* {@link LayeredSocketFactory LayeredSocketFactory}.
|
||||
*
|
||||
* @return the socket factory for this scheme
|
||||
*/
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
|
||||
package org.apache.http.conn.ssl;
|
||||
|
||||
import org.apache.http.conn.SecureSocketFactory;
|
||||
import org.apache.http.conn.LayeredSocketFactory;
|
||||
import org.apache.http.params.HttpConnectionParams;
|
||||
import org.apache.http.params.HttpParams;
|
||||
|
||||
|
@ -55,20 +55,20 @@ import java.security.SecureRandom;
|
|||
import java.security.UnrecoverableKeyException;
|
||||
|
||||
/**
|
||||
* Secure socket factory based on JSSE
|
||||
* Layered socket factory for TLS/SSL connections, based on JSSE.
|
||||
*.
|
||||
* <p>
|
||||
* SSLProtocolSocketFactory can be used to validate the identity of the HTTPS
|
||||
* server against a list of trusted certificates and to authenticate to the HTTPS
|
||||
* server using a private key.
|
||||
* SSLSocketFactory can be used to validate the identity of the HTTPS
|
||||
* server against a list of trusted certificates and to authenticate to
|
||||
* the HTTPS server using a private key.
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* SSLProtocolSocketFactory will enable server authentication when supplied with
|
||||
* a {@link KeyStore truststore} file containg one or several trusted certificates.
|
||||
* The client secure socket will reject the connection during the SSL session handshake
|
||||
* if the target HTTPS server attempts to authenticate itself with a non-trusted
|
||||
* certificate.
|
||||
* SSLSocketFactory will enable server authentication when supplied with
|
||||
* a {@link KeyStore truststore} file containg one or several trusted
|
||||
* certificates. The client secure socket will reject the connection during
|
||||
* the SSL session handshake if the target HTTPS server attempts to
|
||||
* authenticate itself with a non-trusted certificate.
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
|
@ -79,12 +79,13 @@ import java.security.UnrecoverableKeyException;
|
|||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* SSLProtocolSocketFactory will enable client authentication when supplied with
|
||||
* a {@link KeyStore keystore} file containg a private key/public certificate pair.
|
||||
* The client secure socket will use the private key to authenticate itself to the target
|
||||
* HTTPS server during the SSL session handshake if requested to do so by the server.
|
||||
* The target HTTPS server will in its turn verify the certificate presented by the client
|
||||
* in order to establish client's authenticity
|
||||
* SSLSocketFactory will enable client authentication when supplied with
|
||||
* a {@link KeyStore keystore} file containg a private key/public certificate
|
||||
* pair. The client secure socket will use the private key to authenticate
|
||||
* itself to the target HTTPS server during the SSL session handshake if
|
||||
* requested to do so by the server.
|
||||
* The target HTTPS server will in its turn verify the certificate presented
|
||||
* by the client in order to establish client's authenticity
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
|
@ -134,7 +135,7 @@ import java.security.UnrecoverableKeyException;
|
|||
* @author Julius Davies
|
||||
*/
|
||||
|
||||
public class SSLSocketFactory implements SecureSocketFactory {
|
||||
public class SSLSocketFactory implements LayeredSocketFactory {
|
||||
|
||||
public static final String TLS = "TLS";
|
||||
public static final String SSL = "SSL";
|
||||
|
@ -339,9 +340,7 @@ public class SSLSocketFactory implements SecureSocketFactory {
|
|||
} // isSecure
|
||||
|
||||
|
||||
/**
|
||||
* @see SecureSocketFactory#createSocket(java.net.Socket,java.lang.String,int,boolean)
|
||||
*/
|
||||
// non-javadoc, see interface LayeredSocketFactory
|
||||
public Socket createSocket(
|
||||
final Socket socket,
|
||||
final String host,
|
||||
|
|
|
@ -43,7 +43,7 @@ import org.apache.http.protocol.HttpContext;
|
|||
import org.apache.http.conn.Scheme;
|
||||
import org.apache.http.conn.SchemeRegistry;
|
||||
import org.apache.http.conn.SocketFactory;
|
||||
import org.apache.http.conn.SecureSocketFactory;
|
||||
import org.apache.http.conn.LayeredSocketFactory;
|
||||
import org.apache.http.conn.OperatedClientConnection;
|
||||
import org.apache.http.conn.ClientConnectionOperator;
|
||||
|
||||
|
@ -174,14 +174,14 @@ public class DefaultClientConnectionOperator
|
|||
("Unknown scheme '" + target.getSchemeName() +
|
||||
"' in target host.");
|
||||
}
|
||||
if (!(schm.getSocketFactory() instanceof SecureSocketFactory)) {
|
||||
if (!(schm.getSocketFactory() instanceof LayeredSocketFactory)) {
|
||||
throw new IllegalArgumentException
|
||||
("Target scheme (" + schm.getName() +
|
||||
") must have secure socket factory.");
|
||||
") must have layered socket factory.");
|
||||
}
|
||||
|
||||
final SecureSocketFactory ssf =
|
||||
(SecureSocketFactory)schm.getSocketFactory();
|
||||
final LayeredSocketFactory ssf =
|
||||
(LayeredSocketFactory)schm.getSocketFactory();
|
||||
final Socket sock = ssf.createSocket
|
||||
(conn.getSocket(), target.getHostName(), target.getPort(), true);
|
||||
prepareSocket(sock, context, params);
|
||||
|
|
|
@ -32,16 +32,16 @@ package org.apache.http.mockup;
|
|||
|
||||
import java.net.Socket;
|
||||
|
||||
import org.apache.http.conn.SecureSocketFactory;
|
||||
import org.apache.http.conn.LayeredSocketFactory;
|
||||
|
||||
/**
|
||||
* {@link SecureSocketFactory} mockup implementation.
|
||||
*/
|
||||
public class SecureSocketFactoryMockup extends SocketFactoryMockup
|
||||
implements SecureSocketFactory {
|
||||
implements LayeredSocketFactory {
|
||||
|
||||
/* A default instance of this mockup. */
|
||||
public final static SecureSocketFactory INSTANCE =
|
||||
public final static LayeredSocketFactory INSTANCE =
|
||||
new SecureSocketFactoryMockup("INSTANCE");
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue