From 56b9ead088c59ea76d796002e74d42d7e31eac44 Mon Sep 17 00:00:00 2001 From: "Endi S. Dewata" Date: Mon, 10 Feb 2014 13:56:15 -0500 Subject: Added CLI parameter to select message format. A new CLI parameter has been added to allow the user select the REST message format. This is done by setting the default consumes and produces when creating the client proxy. For this to work the hard-coded @Consumes and @Produces annotations need to be removed from the interface definition. A new interceptor has been added to validate the message format before executing the operation. Ticket #554 --- base/java-tools/src/com/netscape/cmstools/cli/MainCLI.java | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'base/java-tools/src/com') 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 082c8140b..3527238d2 100644 --- a/base/java-tools/src/com/netscape/cmstools/cli/MainCLI.java +++ b/base/java-tools/src/com/netscape/cmstools/cli/MainCLI.java @@ -185,6 +185,10 @@ public class MainCLI extends CLI { option.setArgName("list"); options.addOption(option); + option = new Option(null, "message-format", true, "Message format: xml (default), json"); + option.setArgName("format"); + options.addOption(option); + options.addOption("v", false, "Verbose"); options.addOption(null, "help", false, "Help"); options.addOption(null, "version", false, "Version"); @@ -252,6 +256,10 @@ public class MainCLI extends CLI { } if (verbose) System.out.println("Security database: "+this.certDatabase.getAbsolutePath()); + + String messageFormat = cmd.getOptionValue("message-format"); + config.setMessageFormat(messageFormat); + if (verbose) System.out.println("Message format: " + messageFormat); } public void convertCertStatusList(String list, Collection statuses) throws Exception { -- cgit