diff options
| author | Endi Sukma Dewata <edewata@redhat.com> | 2013-03-18 12:30:17 -0400 |
|---|---|---|
| committer | Endi Sukma Dewata <edewata@redhat.com> | 2013-03-22 10:48:19 -0400 |
| commit | 4bc8e8ea1823d09d4877ee301e29564244e234d4 (patch) | |
| tree | 9cbaaa88c53ec8dd586f6df7ec3943804b19769c /base/java-tools/src | |
| parent | b70ec401d53625e93fb55b1a130701e295341c48 (diff) | |
| download | pki-4bc8e8ea1823d09d4877ee301e29564244e234d4.tar.gz pki-4bc8e8ea1823d09d4877ee301e29564244e234d4.tar.xz pki-4bc8e8ea1823d09d4877ee301e29564244e234d4.zip | |
Added CLI option to capture HTTP messages.
A new option has been added to the CLI to capture HTTP requests
and responses and store them in the specified folder.
Ticket #523
Diffstat (limited to 'base/java-tools/src')
| -rw-r--r-- | base/java-tools/src/com/netscape/cmstools/cli/MainCLI.java | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/base/java-tools/src/com/netscape/cmstools/cli/MainCLI.java b/base/java-tools/src/com/netscape/cmstools/cli/MainCLI.java index 191a6326d..fb3099754 100644 --- a/base/java-tools/src/com/netscape/cmstools/cli/MainCLI.java +++ b/base/java-tools/src/com/netscape/cmstools/cli/MainCLI.java @@ -50,6 +50,8 @@ public class MainCLI extends CLI { public PKIConnection connection; public AccountClient accountClient; + String output; + public MainCLI() throws Exception { super("pki", "PKI command-line interface"); @@ -132,6 +134,10 @@ public class MainCLI extends CLI { option.setArgName("password"); options.addOption(option); + option = new Option(null, "output", true, "Folder to store HTTP messages"); + option.setArgName("folder"); + options.addOption(option); + options.addOption("v", false, "Verbose"); options.addOption(null, "help", false, "Help"); options.addOption(null, "version", false, "Version"); @@ -139,6 +145,9 @@ public class MainCLI extends CLI { public void parseOptions(CommandLine cmd) throws URISyntaxException { + verbose = cmd.hasOption("v"); + output = cmd.getOptionValue("output"); + String uri = cmd.getOptionValue("U"); String protocol = cmd.getOptionValue("P", "http"); @@ -174,6 +183,12 @@ public class MainCLI extends CLI { connection = new PKIConnection(config); connection.setVerbose(verbose); + if (output != null) { + File file = new File(output); + file.mkdirs(); + connection.setOutput(file); + } + accountClient = new AccountClient(connection); } @@ -204,7 +219,7 @@ public class MainCLI extends CLI { System.exit(1); } - verbose = cmd.hasOption("v"); + parseOptions(cmd); if (verbose) { System.out.print("Command:"); @@ -215,8 +230,6 @@ public class MainCLI extends CLI { System.out.println(); } - parseOptions(cmd); - String command = cmdArgs[0]; String moduleName; String moduleCommand; |
