/** * Open a connection using the reciever and the given path * @param path the path to the required resource (path here is * the portion after the <code>hostname:port</code> portion of a URL) * @return a connection to the required resource. The * connection returned may be a sub-class of * <code>URLConnection</code> including * <code>HttpsURLConnection</code>. If the sub-class is a * <code>HttpsURLConnection</code> then this connection will * accept any certificate from any server where the server's * name matches the host name of this object. Specifically we * allows the certificate <em>not</em> to contain the name of * the server. This is a potential security hole, but is also a * usability enhancement. * @throws IOException if there's a problem in connecting to the * resource */ public URLConnection openConnection(String path) throws IOException { if (path == null || path.trim().length() == 0) path = this.path; final URLConnection cnx = this.openConnection(this.toURL(path)); if (! (cnx instanceof HttpsURLConnection)) { return cnx; } configureSSL((HttpsURLConnection) cnx); return cnx; }
/** * Open a connection using the reciever and the given path * @param path the path to the required resource (path here is * the portion after the <code>hostname:port</code> portion of a URL) * @return a connection to the required resource. The * connection returned may be a sub-class of * <code>URLConnection</code> including * <code>HttpsURLConnection</code>. If the sub-class is a * <code>HttpsURLConnection</code> then this connection will * accept any certificate from any server where the server's * name matches the host name of this object. Specifically we * allows the certificate <em>not</em> to contain the name of * the server. This is a potential security hole, but is also a * usability enhancement. * @throws IOException if there's a problem in connecting to the * resource */ public URLConnection openConnection(String path) throws IOException { if (path == null || path.trim().length() == 0) path = this.path; final URLConnection cnx = this.openConnection(this.toURL(path)); if (! (cnx instanceof HttpsURLConnection)) { return cnx; } configureSSL((HttpsURLConnection) cnx); return cnx; }