Name: boT120536 Date: 12/27/2000
java version "1.3.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
Java HotSpot(TM) Client VM (build 1.3.0-C, mixed mode)
import java.net.*;
public class URLTest {
public static void main(String args[]) throws Exception {
/*********************************************************************/
/* The URL class doesn't allow for E-Mail addresses as logins or */
/* passwords. An example of this would be anonymous FTP requires */
/* that you use the login 'anonymous' and your E-Mail address as */
/* your password. It chokes even worse when you try to use an */
/* E-Mail address as a login. Of particular interest is the */
/* getUserInfo() which is obviously giving wrong results. */
/*********************************************************************/
URL myURL = new URL
("ftp://anonymous:###@###.###@www.address.com/file.html");
System.out.println("getAuthority: " + myURL.getAuthority());
System.out.println("getFile: " + myURL.getFile());
System.out.println("getHost: " + myURL.getHost());
System.out.println("getPath: " + myURL.getPath());
System.out.println("getPort: " + myURL.getPort());
System.out.println("getProtocol: " + myURL.getProtocol());
System.out.println("getQuery: " + myURL.getQuery());
System.out.println("getRef: " + myURL.getRef());
System.out.println("getUserInfo: " + myURL.getUserInfo());
}
}
(Review ID: 111021)
======================================================================