void doit() { String username = args.Username; String password = args.Password; if (username != null || password != null) Authenticator.setDefault(new MyAuthenticator(username, password)); System.setProperty("java.protocol.handler.pkgs", "edu.mscd.cs"); String[] add = args.additional; if (add == null) { logger.warning("No URLs specified, exiting"); System.exit(1); } /* ** add the specified URLs to the list to be fetched. */ String[] t = new String[add.length]; for (int i = 0; i < add.length; i++) { t[i] = "<a href=\"" + add[i] + "\">"; } /* ** add to the URLs, with no base */ addToURLs(null, t); fetchAll(); /* ** shall we save the cookies to a file? */ String savecookies = args.SaveCookies; if (savecookies != null) cookies.saveCookies(savecookies); }
REplican(String arguments[]) { JCLO jclo = new JCLO(args); if (arguments.length == 0) { System.out.println("Arguments:\n" + jclo.usage() + "URLs..."); System.exit(1); } try { jclo.parse(arguments); } catch (IllegalArgumentException IAE) { System.err.println(IAE); System.err.println("Arguments:\n" + jclo.usage() + "URLs..."); System.exit(0); } String logLevel = args.LogLevel; ConsoleHandler ch = new ConsoleHandler(); if (logLevel != null) { Level level = JavaLN.getLevel(logLevel); ch.setLevel(level); ch.setFormatter(new LineNumberFormatter()); logger.setLevel(level); } else { ch.setFormatter(new NullFormatter()); } logger.addHandler(ch); logger.setUseParentHandlers(false); if (args.Version) { System.out.println(Version.getVersion()); System.exit(0); } if (args.Help) { System.out.println("Arguments:\n" + jclo.usage() + "URLs..."); System.exit(0); } cookies = new Cookies(); setDefaults(); if (args.LoadCookies != null) { for (int i = 0; i < args.LoadCookies.length; i++) { logger.config("Loading cookies from " + args.LoadCookies[i]); cookies.loadCookies(args.LoadCookies[i]); } } if (args.PlistCookies != null) { for (int i = 0; i < args.PlistCookies.length; i++) { logger.config("Loading cookies from " + args.PlistCookies[i]); new Plist("file:" + args.PlistCookies[i], cookies); } } if (args.CheckpointEvery != 0) { logger.config("Loading urls from " + args.CheckpointFile); try { ObjectInputStream ois = new ObjectInputStream(new FileInputStream(args.CheckpointFile)); urls = (Hashtable) ois.readObject(); ois.close(); } catch (IOException ioe) { logger.throwing(ioe); } catch (ClassNotFoundException cnfe) { logger.throwing(cnfe); } } if (args.FollowRedirects) HttpURLConnection.setFollowRedirects(false); }