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.security.Principal;
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
62 *
63 */
64
65 // For both copies of the file, uncomment one line and comment the
66 // other. The differences between the two copies are introduced for
67 // plugin, and it is marked as such.
68 public class HttpsURLConnectionImpl
69 extends javax.net.ssl.HttpsURLConnection {
70 // public class HttpsURLConnectionOldImpl
71 // extends com.sun.net.ssl.HttpsURLConnection {
72
73 // NOTE: made protected for plugin so that subclass can set it.
74 protected DelegateHttpsURLConnection delegate;
75
76 // For both copies of the file, uncomment one line and comment the other
77 HttpsURLConnectionImpl(URL u, Handler handler) throws IOException {
78 // HttpsURLConnectionOldImpl(URL u, Handler handler) throws IOException {
79 this(u, null, handler);
80 }
81
82 // For both copies of the file, uncomment one line and comment the other
83 HttpsURLConnectionImpl(URL u, Proxy p, Handler handler) throws IOException {
84 // HttpsURLConnectionOldImpl(URL u, Proxy p, Handler handler) throws IOException {
85 super(u);
86 delegate = new DelegateHttpsURLConnection(url, p, handler, this);
87 }
88
89 // NOTE: introduced for plugin
90 // subclass needs to overwrite this to set delegate to
91 // the appropriate delegatee
92 protected HttpsURLConnectionImpl(URL u) throws IOException {
93 super(u);
94 }
95
96 /**
97 * Create a new HttpClient object, bypassing the cache of
98 * HTTP client objects/connections.
99 *
100 * @param url the URL being accessed
101 */
102 protected void setNewClient(URL url) throws IOException {
103 delegate.setNewClient(url, false);
104 }
105
|
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.security.Principal;
46 import java.util.Map;
47 import java.util.List;
48 import sun.net.www.http.HttpClient;
49
50 /**
51 * A class to represent an HTTP connection to a remote object.
52 *
53 * Ideally, this class should subclass and inherit the http handler
54 * implementation, but it can't do so because that class have the
55 * wrong Java Type. Thus it uses the delegate (aka, the
56 * Adapter/Wrapper design pattern) to reuse code from the http
57 * handler.
58 *
59 * Since it would use a delegate to access
60 * sun.net.www.protocol.http.HttpURLConnection functionalities, it
61 * needs to implement all public methods in it's super class and all
63 *
64 */
65
66 // For both copies of the file, uncomment one line and comment the
67 // other. The differences between the two copies are introduced for
68 // plugin, and it is marked as such.
69 public class HttpsURLConnectionImpl
70 extends javax.net.ssl.HttpsURLConnection {
71 // public class HttpsURLConnectionOldImpl
72 // extends com.sun.net.ssl.HttpsURLConnection {
73
74 // NOTE: made protected for plugin so that subclass can set it.
75 protected DelegateHttpsURLConnection delegate;
76
77 // For both copies of the file, uncomment one line and comment the other
78 HttpsURLConnectionImpl(URL u, Handler handler) throws IOException {
79 // HttpsURLConnectionOldImpl(URL u, Handler handler) throws IOException {
80 this(u, null, handler);
81 }
82
83 static URL checkURL(URL u) throws IOException {
84 if (u != null) {
85 if (u.toExternalForm().indexOf('\n') > -1) {
86 throw new MalformedURLException("Illegal character in URL");
87 }
88 }
89 return u;
90 }
91 // For both copies of the file, uncomment one line and comment the other
92 HttpsURLConnectionImpl(URL u, Proxy p, Handler handler) throws IOException {
93 // HttpsURLConnectionOldImpl(URL u, Proxy p, Handler handler) throws IOException {
94 super(checkURL(u));
95 delegate = new DelegateHttpsURLConnection(url, p, handler, this);
96 }
97
98 // NOTE: introduced for plugin
99 // subclass needs to overwrite this to set delegate to
100 // the appropriate delegatee
101 protected HttpsURLConnectionImpl(URL u) throws IOException {
102 super(u);
103 }
104
105 /**
106 * Create a new HttpClient object, bypassing the cache of
107 * HTTP client objects/connections.
108 *
109 * @param url the URL being accessed
110 */
111 protected void setNewClient(URL url) throws IOException {
112 delegate.setNewClient(url, false);
113 }
114
|