FileDocCategorySizeDatePackage
ProtocolHandlerTestApplet.javaAPI DocExample3301Sun Dec 12 10:55:26 GMT 2004None

ProtocolHandlerTestApplet

public class ProtocolHandlerTestApplet extends Applet implements URLStreamHandlerFactory

Fields Summary
TextArea
results
Constructors Summary
Methods Summary
public java.net.URLStreamHandlercreateURLStreamHandler(java.lang.String scheme)

    return null; 
  
public voidinit()


     
    this.setLayout(new BorderLayout());
    this.add("Center", results);    
  
public voidstart()

    try {
      Properties p = System.getProperties();
      Enumeration list = p.elements();
      String s = "";
      while (list.hasMoreElements()) {
        Object o = list.nextElement();
        s += o.toString();
        s += "\r\n"; 
      }

      results.append(s);  
    }
    catch (Throwable e) {
      results.append(e.toString() + "\r\n");  
    } 
    try {
      results.append("Trying to get java.version\r\n");  
      String s = System.getProperty("java.version",".");
      if (s == null) s = "no such property";
      s += "\r\n";
      results.append(s);  
    }
    catch (Throwable e) {
      results.append(e.toString() + "\r\n");  
    }   
    try {
      results.append("Trying to get classpath\r\n");  
      String s = System.getProperty("java.class.path",".");
      if (s == null) s = "no such property";
      s += "\r\n";
      results.append(s);  
    }
    catch (Throwable e) {
      results.append(e.toString() + "\r\n");  
    }
    try {
      results.append("Trying to get java.protocol.handler.pkgs\r\n");  
      String s = System.getProperty("java.protocol.handler.pkgs");
      if (s == null) s = "no such property";
      s += "; get succeeded\r\n";
      results.append(s);  
    }
    catch (Throwable e) {
      results.append(e.toString() + "\r\n");  
    }
    try {
      results.append("Trying to get java.content.handler.pkgs\r\n");  
      String s = System.getProperty("java.content.handler.pkgs");
      if (s == null) s = "no such property";
      s += "; get succeeded\r\n";
      results.append(s);  
    }
    catch (Throwable e) {
      results.append(e.toString() + "\r\n");  
    }
    try {
      results.append("Trying to set java.protocol.handler.pkgs\r\n");  
      System.setProperty("java.protocol.handler.pkgs", "com.macfaq.net.www.protocol"); 
    }
    catch (Throwable e) {
      results.append(e.toString() + "\r\n");  
    }
    try {
      results.append("Trying to set URLStreamHandlerFactory\r\n");  
      URL.setURLStreamHandlerFactory(this);      
    }
    catch (Throwable e) {
      results.append(e.toString() + "\r\n");  
    }
    try {
      results.append("Trying to construct chargen URL\r\n");  
      URL u = new URL("chargen://vision.poly.edu");      
      results.append(u + "\r\n");  
    }
    catch (Throwable e) {
      results.append(e.toString() + "\r\n");  
    }
    try {
      results.append("Trying to construct impgen URL\r\n");  
      URL u = new URL("impgen://vision.poly.edu");      
      results.append(u + "\r\n");  
    }
    catch (Throwable e) {
      results.append(e.toString() + "\r\n");  
    }