1 /*
2 * ====================================================================
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License. You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied. See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 * ====================================================================
20 *
21 * This software consists of voluntary contributions made by many
22 * individuals on behalf of the Apache Software Foundation. For more
23 * information on the Apache Software Foundation, please see
24 * <http://www.apache.org/>.
25 *
26 */
27 package org.apache.http.impl.conn;
28
29 import org.apache.http.annotation.ThreadSafe;
30 import org.apache.http.conn.scheme.PlainSocketFactory;
31 import org.apache.http.conn.scheme.Scheme;
32 import org.apache.http.conn.scheme.SchemeRegistry;
33 import org.apache.http.conn.ssl.SSLSocketFactory;
34 import org.apache.http.impl.client.HttpClientBuilder;
35
36 /**
37 * @since 4.1
38 *
39 * @deprecated (4.3) use {@link HttpClientBuilder}.
40 */
41 @ThreadSafe
42 @Deprecated
43 public final class SchemeRegistryFactory {
44
45 /**
46 * Initializes default scheme registry based on JSSE defaults. System properties will
47 * not be taken into consideration.
48 */
49 public static SchemeRegistry createDefault() {
50 final SchemeRegistry registry = new SchemeRegistry();
51 registry.register(
52 new Scheme("http", 80, PlainSocketFactory.getSocketFactory()));
53 registry.register(
54 new Scheme("https", 443, SSLSocketFactory.getSocketFactory()));
55 return registry;
56 }
57
58 /**
59 * Initializes default scheme registry using system properties as described in
60 * <a href="http://download.oracle.com/javase/1,5.0/docs/guide/security/jsse/JSSERefGuide.html">
61 * "JavaTM Secure Socket Extension (JSSE) Reference Guide for the JavaTM 2 Platform
62 * Standard Edition 5</a>
63 * <p>
64 * The following system properties are taken into account by this method:
65 * <ul>
66 * <li>ssl.TrustManagerFactory.algorithm</li>
67 * <li>javax.net.ssl.trustStoreType</li>
68 * <li>javax.net.ssl.trustStore</li>
69 * <li>javax.net.ssl.trustStoreProvider</li>
70 * <li>javax.net.ssl.trustStorePassword</li>
71 * <li>java.home</li>
72 * <li>ssl.KeyManagerFactory.algorithm</li>
73 * <li>javax.net.ssl.keyStoreType</li>
74 * <li>javax.net.ssl.keyStore</li>
75 * <li>javax.net.ssl.keyStoreProvider</li>
76 * <li>javax.net.ssl.keyStorePassword</li>
77 * </ul>
78 * <p>
79 *
80 * @since 4.2
81 */
82 public static SchemeRegistry createSystemDefault() {
83 final SchemeRegistry registry = new SchemeRegistry();
84 registry.register(
85 new Scheme("http", 80, PlainSocketFactory.getSocketFactory()));
86 registry.register(
87 new Scheme("https", 443, SSLSocketFactory.getSystemSocketFactory()));
88 return registry;
89 }
90 }
91