21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26 /*
27 * NOTE: This class lives in the package sun.net.www.protocol.https.
28 * There is a copy in com.sun.net.ssl.internal.www.protocol.https for JSSE
29 * 1.0.2 compatibility. It is 100% identical except the package and extends
30 * lines. Any changes should be made to be class in sun.net.* and then copied
31 * to com.sun.net.*.
32 */
33
34 // For both copies of the file, uncomment one line and comment the other
35 // package sun.net.www.protocol.https;
36 package com.sun.net.ssl.internal.www.protocol.https;
37
38 import java.net.URL;
39 import java.net.Proxy;
40 import java.net.ProtocolException;
41 import java.io.*;
42 import javax.net.ssl.*;
43 import java.security.Permission;
44 import java.util.Map;
45 import java.util.List;
46 import sun.net.www.http.HttpClient;
47
48 /**
49 * A class to represent an HTTP connection to a remote object.
50 *
51 * Ideally, this class should subclass and inherit the http handler
52 * implementation, but it can't do so because that class have the
53 * wrong Java Type. Thus it uses the delegate (aka, the
54 * Adapter/Wrapper design pattern) to reuse code from the http
55 * handler.
56 *
57 * Since it would use a delegate to access
58 * sun.net.www.protocol.http.HttpURLConnection functionalities, it
59 * needs to implement all public methods in it's super class and all
60 * the way to Object.
61 *
62 */
63
64 // For both copies of the file, uncomment one line and comment the other
65 // public class HttpsURLConnectionImpl
66 // extends javax.net.ssl.HttpsURLConnection {
67 public class HttpsURLConnectionOldImpl
68 extends com.sun.net.ssl.HttpsURLConnection {
69
70 private DelegateHttpsURLConnection delegate;
71
72 // For both copies of the file, uncomment one line and comment the other
73 // HttpsURLConnectionImpl(URL u, Handler handler) throws IOException {
74 HttpsURLConnectionOldImpl(URL u, Handler handler) throws IOException {
75 this(u, null, handler);
76 }
77
78 // For both copies of the file, uncomment one line and comment the other
79 // HttpsURLConnectionImpl(URL u, Handler handler) throws IOException {
80 HttpsURLConnectionOldImpl(URL u, Proxy p, Handler handler) throws IOException {
81 super(u);
82 delegate = new DelegateHttpsURLConnection(url, p, handler, this);
83 }
84
85 /**
86 * Create a new HttpClient object, bypassing the cache of
87 * HTTP client objects/connections.
88 *
89 * @param url the URL being accessed
90 */
91 protected void setNewClient(URL url) throws IOException {
92 delegate.setNewClient(url, false);
93 }
94
95 /**
96 * Obtain a HttpClient object. Use the cached copy if specified.
97 *
98 * @param url the URL being accessed
99 * @param useCache whether the cached connection should be used
100 * if present
101 */
|
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26 /*
27 * NOTE: This class lives in the package sun.net.www.protocol.https.
28 * There is a copy in com.sun.net.ssl.internal.www.protocol.https for JSSE
29 * 1.0.2 compatibility. It is 100% identical except the package and extends
30 * lines. Any changes should be made to be class in sun.net.* and then copied
31 * to com.sun.net.*.
32 */
33
34 // For both copies of the file, uncomment one line and comment the other
35 // package sun.net.www.protocol.https;
36 package com.sun.net.ssl.internal.www.protocol.https;
37
38 import java.net.URL;
39 import java.net.Proxy;
40 import java.net.ProtocolException;
41 import java.net.MalformedURLException;
42 import java.io.*;
43 import javax.net.ssl.*;
44 import java.security.Permission;
45 import java.util.Map;
46 import java.util.List;
47 import sun.net.www.http.HttpClient;
48
49 /**
50 * A class to represent an HTTP connection to a remote object.
51 *
52 * Ideally, this class should subclass and inherit the http handler
53 * implementation, but it can't do so because that class have the
54 * wrong Java Type. Thus it uses the delegate (aka, the
55 * Adapter/Wrapper design pattern) to reuse code from the http
56 * handler.
57 *
58 * Since it would use a delegate to access
59 * sun.net.www.protocol.http.HttpURLConnection functionalities, it
60 * needs to implement all public methods in it's super class and all
61 * the way to Object.
62 *
63 */
64
65 // For both copies of the file, uncomment one line and comment the other
66 // public class HttpsURLConnectionImpl
67 // extends javax.net.ssl.HttpsURLConnection {
68 public class HttpsURLConnectionOldImpl
69 extends com.sun.net.ssl.HttpsURLConnection {
70
71 private DelegateHttpsURLConnection delegate;
72
73 // For both copies of the file, uncomment one line and comment the other
74 // HttpsURLConnectionImpl(URL u, Handler handler) throws IOException {
75 HttpsURLConnectionOldImpl(URL u, Handler handler) throws IOException {
76 this(u, null, handler);
77 }
78
79 static URL checkURL(URL u) throws IOException {
80 if (u != null) {
81 if (u.toExternalForm().indexOf('\n') > -1) {
82 throw new MalformedURLException("Illegal character in URL");
83 }
84 }
85 return u;
86 }
87 // For both copies of the file, uncomment one line and comment the other
88 // HttpsURLConnectionImpl(URL u, Handler handler) throws IOException {
89 HttpsURLConnectionOldImpl(URL u, Proxy p, Handler handler) throws IOException {
90 super(checkURL(u));
91 delegate = new DelegateHttpsURLConnection(url, p, handler, this);
92 }
93
94 /**
95 * Create a new HttpClient object, bypassing the cache of
96 * HTTP client objects/connections.
97 *
98 * @param url the URL being accessed
99 */
100 protected void setNewClient(URL url) throws IOException {
101 delegate.setNewClient(url, false);
102 }
103
104 /**
105 * Obtain a HttpClient object. Use the cached copy if specified.
106 *
107 * @param url the URL being accessed
108 * @param useCache whether the cached connection should be used
109 * if present
110 */
|