1 23 24 package org.apache.webdav.cmd; 25 26 27 import org.apache.commons.httpclient.contrib.ssl.*; 28 import org.apache.commons.httpclient.protocol.Protocol; 29 30 31 35 public class Slide { 36 37 40 public final static String version = "Slide client @VERSION@"; 41 42 public static void main(String [] args) { 43 Client client = new Client(System.in,System.out); 44 45 String remoteHost = null; 46 47 String argOptions = null; 49 50 for (int i = 0; i < args.length; i++) { 52 if (args[i].startsWith("-")) { 53 if (argOptions != null) 54 argOptions += args[i].substring(1); 55 else 56 argOptions = args[i]; 57 } else { 58 remoteHost = args[i]; 59 } 60 } 61 62 if (argOptions != null) { 64 char option; 65 for (int i = 0; i < argOptions.length(); i++) { 66 option = argOptions.charAt(i); 67 switch (option) { 68 case '-': 69 break; 70 case 'h': 71 printCmdLineUsage(); 72 break; 73 case 'v': 74 System.out.println(version); 75 break; 76 case 'd': 77 client.setDebug(Client.DEBUG_ON); 78 break; 79 case 's': 80 Protocol.registerProtocol("https", 81 new Protocol("https", 82 new EasySSLProtocolSocketFactory(), 83 443)); 84 break; 85 default: 86 System.exit(-1); 87 } 88 } 89 } 90 92 if (remoteHost != null) { 93 client.connect(remoteHost); 94 } 95 96 client.run(); 97 } 98 99 102 private static void printCmdLineUsage() 103 { 104 105 System.out.println("Usage: Slide [-vdhs] " + 106 "http://hostname[:port][/path]"); 107 System.out.println 108 (" Default protocol: http, port: 80, path: /"); 109 System.out.println("Options:"); 110 System.out.println(" -v: Print version information."); 111 System.out.println(" -d: Debug."); 112 System.out.println(" -h: Print this help message."); 113 System.out.println(" -s: use EasySSLProtocol"); 114 System.out.println( 115 "Please, email bug reports to slide-user@jakarta.apache.org"); 116 } 117 } 118 119 | Popular Tags |