diff options
9 files changed, 48 insertions, 12 deletions
diff --git a/pki/base/common/src/com/netscape/certsrv/profile/IProfile.java b/pki/base/common/src/com/netscape/certsrv/profile/IProfile.java index c8ca1472..43a9f8a3 100644 --- a/pki/base/common/src/com/netscape/certsrv/profile/IProfile.java +++ b/pki/base/common/src/com/netscape/certsrv/profile/IProfile.java @@ -189,6 +189,11 @@ public interface IProfile { */ public String isRenewal(); + /* + * is output going to be in xml? + */ + public String isXmlOutput(); + /** * Returns the profile name. * diff --git a/pki/base/common/src/com/netscape/cms/profile/common/BasicProfile.java b/pki/base/common/src/com/netscape/cms/profile/common/BasicProfile.java index d96bec0b..25ee47cd 100644 --- a/pki/base/common/src/com/netscape/cms/profile/common/BasicProfile.java +++ b/pki/base/common/src/com/netscape/cms/profile/common/BasicProfile.java @@ -41,6 +41,7 @@ public abstract class BasicProfile implements IProfile { public static final String PROP_ENABLE = "enable"; public static final String PROP_ENABLE_BY = "enableBy"; public static final String PROP_IS_RENEWAL = "renewal"; + public static final String PROP_XML_OUTPUT = "xmlOutput"; public static final String PROP_VISIBLE = "visible"; public static final String PROP_INPUT_LIST = "list"; public static final String PROP_OUTPUT_LIST = "list"; @@ -95,6 +96,14 @@ public abstract class BasicProfile implements IProfile { } } + public String isXmlOutput() { + try { + return mConfig.getString(PROP_XML_OUTPUT, "false"); + } catch (EBaseException e) { + return "false"; + } + } + public String getApprovedBy() { try { return mConfig.getString(PROP_ENABLE_BY, ""); diff --git a/pki/base/common/src/com/netscape/cms/servlet/base/CMSServlet.java b/pki/base/common/src/com/netscape/cms/servlet/base/CMSServlet.java index 0c1cf2f9..0ef2ee5d 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/base/CMSServlet.java +++ b/pki/base/common/src/com/netscape/cms/servlet/base/CMSServlet.java @@ -2073,16 +2073,23 @@ public abstract class CMSServlet extends HttpServlet { } protected void outputError(HttpServletResponse httpResp, String errorString) { - outputError(httpResp, FAILURE, errorString); + outputError(httpResp, FAILURE, errorString, null); } - protected void outputError(HttpServletResponse httpResp, String status, String errorString) { + protected void outputError(HttpServletResponse httpResp, String errorString, String requestId) { + outputError(httpResp, FAILURE, errorString, null); + } + + protected void outputError(HttpServletResponse httpResp, String status, String errorString, String requestId) { XMLObject xmlObj = null; try { xmlObj = new XMLObject(); Node root = xmlObj.createRoot("XMLResponse"); xmlObj.addItemToContainer(root, "Status", status); xmlObj.addItemToContainer(root, "Error", errorString); + if (requestId != null) { + xmlObj.addItemToContainer(root, "RequestId", requestId); + } byte[] cb = xmlObj.toByteArray(); OutputStream os = httpResp.getOutputStream(); diff --git a/pki/base/common/src/com/netscape/cms/servlet/profile/ProfileSelectServlet.java b/pki/base/common/src/com/netscape/cms/servlet/profile/ProfileSelectServlet.java index dd1860ee..8267a143 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/profile/ProfileSelectServlet.java +++ b/pki/base/common/src/com/netscape/cms/servlet/profile/ProfileSelectServlet.java @@ -334,6 +334,7 @@ public class ProfileSelectServlet extends ProfileServlet { args.set(ARG_INPUT_LIST, inputlist); args.set(ARG_INPUT_PLUGIN_LIST, inputPluginlist); args.set(ARG_IS_RENEWAL, profile.isRenewal()); + args.set(ARG_XML_OUTPUT, profile.isXmlOutput()); // (5) return info as template outputTemplate(request, response, args); diff --git a/pki/base/common/src/com/netscape/cms/servlet/profile/ProfileServlet.java b/pki/base/common/src/com/netscape/cms/servlet/profile/ProfileServlet.java index 9ce0d55b..ca1d1b08 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/profile/ProfileServlet.java +++ b/pki/base/common/src/com/netscape/cms/servlet/profile/ProfileServlet.java @@ -108,6 +108,7 @@ public class ProfileServlet extends CMSServlet { public final static String ARG_INPUT_NAME = "inputName"; public final static String ARG_INPUT_VAL = "inputVal"; public final static String ARG_IS_RENEWAL = "renewal"; + public final static String ARG_XML_OUTPUT = "xmlOutput"; public final static String ARG_OUTPUT_LIST = "outputList"; public final static String ARG_OUTPUT_ID = "outputId"; public final static String ARG_OUTPUT_SYNTAX = "outputSyntax"; diff --git a/pki/base/common/src/com/netscape/cms/servlet/profile/ProfileSubmitServlet.java b/pki/base/common/src/com/netscape/cms/servlet/profile/ProfileSubmitServlet.java index 3e270a03..995ca5e3 100644 --- a/pki/base/common/src/com/netscape/cms/servlet/profile/ProfileSubmitServlet.java +++ b/pki/base/common/src/com/netscape/cms/servlet/profile/ProfileSubmitServlet.java @@ -417,8 +417,12 @@ public class ProfileSubmitServlet extends ProfileServlet { boolean xmlOutput = false; String v = request.getParameter("xmlOutput"); - if (v != null && v.equals("true")) + if ((v != null) && (v.equalsIgnoreCase("true"))) { + CMS.debug("xmlOutput true"); xmlOutput = true; + } else { + CMS.debug("xmlOutput false"); + } IStatsSubsystem statsSub = (IStatsSubsystem)CMS.getSubsystem("stats"); if (statsSub != null) { @@ -898,7 +902,7 @@ public class ProfileSubmitServlet extends ProfileServlet { e.toString()); // authentication error if (xmlOutput) { - outputError(response, AUTH_FAILURE, CMS.getUserMessage(locale, "CMS_AUTHENTICATION_ERROR")); + outputError(response, CMS.getUserMessage(locale, "CMS_AUTHENTICATION_ERROR")); } else { args.set(ARG_ERROR_CODE, "1"); args.set(ARG_ERROR_REASON, CMS.getUserMessage(locale, @@ -960,7 +964,7 @@ public class ProfileSubmitServlet extends ProfileServlet { reqs = profile.createRequests(ctx, locale); } catch (EProfileException e) { CMS.debug(e); - CMS.debug("ProfileSubmitServlet: 1 createRequests " + e.toString()); + CMS.debug("ProfileSubmitServlet: createRequests " + e.toString()); if (xmlOutput) { outputError(response, e.toString()); } else { @@ -1059,7 +1063,7 @@ public class ProfileSubmitServlet extends ProfileServlet { // no profile set found CMS.debug("ProfileSubmitServlet: no profile policy set found"); if (xmlOutput) { - outputError(response, CMS.getUserMessage("CMS_PROFILE_NO_POLICY_SET_FOUND")); + outputError(response, FAILED, CMS.getUserMessage("CMS_PROFILE_NO_POLICY_SET_FOUND"), reqs[k].getRequestId().toString()); } else { args.set(ARG_ERROR_CODE, "1"); args.set(ARG_ERROR_REASON, @@ -1092,7 +1096,7 @@ public class ProfileSubmitServlet extends ProfileServlet { } catch (EProfileException e) { CMS.debug("ProfileSubmitServlet: populate " + e.toString()); if (xmlOutput) { - outputError(response, e.toString()); + outputError(response, FAILED, e.toString(), reqs[k].getRequestId().toString()); } else { args.set(ARG_ERROR_CODE, "1"); args.set(ARG_ERROR_REASON, e.toString()); @@ -1108,7 +1112,7 @@ public class ProfileSubmitServlet extends ProfileServlet { // throw new IOException("Profile " + profileId + // " cannot populate"); if (xmlOutput) { - outputError(response, CMS.getUserMessage(locale, "CMS_INTERNAL_ERROR")); + outputError(response, FAILED, CMS.getUserMessage(locale, "CMS_INTERNAL_ERROR"), reqs[k].getRequestId().toString()); } else { args.set(ARG_ERROR_CODE, "1"); args.set(ARG_ERROR_REASON, CMS.getUserMessage(locale, @@ -1135,14 +1139,15 @@ public class ProfileSubmitServlet extends ProfileServlet { /////////////////////////////////////////////// // submit request /////////////////////////////////////////////// + String requestIds = ""; // deliminated with double space for (int k = 0; k < reqs.length; k++) { try { // reset the "auditRequesterID" auditRequesterID = auditRequesterID(reqs[k]); - // print request debug if (reqs[k] != null) { + requestIds += " "+reqs[k].getRequestId().toString(); Enumeration reqKeys = reqs[k].getExtDataKeys(); while (reqKeys.hasMoreElements()) { String reqKey = (String)reqKeys.nextElement(); @@ -1244,7 +1249,8 @@ public class ProfileSubmitServlet extends ProfileServlet { if (errorCode != null) { if (xmlOutput) { - outputError(response, errorReason); + // when errorCode is not null, requestIds should have >=1 + outputError(response, errorCode, errorReason, requestIds); } else { ArgList requestlist = new ArgList(); diff --git a/pki/dogtag/ca-ui/dogtag-pki-ca-ui.spec b/pki/dogtag/ca-ui/dogtag-pki-ca-ui.spec index e49049c6..670eab7a 100644 --- a/pki/dogtag/ca-ui/dogtag-pki-ca-ui.spec +++ b/pki/dogtag/ca-ui/dogtag-pki-ca-ui.spec @@ -34,7 +34,7 @@ ## Package Header Definitions %define base_name %{base_ui_prefix}-%{base_prefix}-%{base_component} %define base_version 1.0.0 -%define base_release 7 +%define base_release 8 %define base_group System Environment/Base %define base_vendor Red Hat, Inc. %define base_license GPLv2 with exceptions @@ -222,6 +222,8 @@ rm -rf ${RPM_BUILD_ROOT} ############################################################################### %changelog +* Wed Jan 28 2009 Christina Fu <cfu@redhat.com> 1.0.0-8 +- Bugzilla Bug #482733 - make outputXML available via profiles; add request id in response for deferred * Fri Nov 28 2008 Matthew Harmsen <mharmsen@redhat.com> 1.0.0-7 - Bugzilla Bug #445402 - changed "linux"/"fedora" to "dogtag"; changed "pki-svn.fedora.redhat.com" to "pki.fedoraproject.org" diff --git a/pki/dogtag/ca-ui/shared/webapps/ca/ee/ca/ProfileSelect.template b/pki/dogtag/ca-ui/shared/webapps/ca/ee/ca/ProfileSelect.template index a3557fcd..0a0fc610 100644 --- a/pki/dogtag/ca-ui/shared/webapps/ca/ee/ca/ProfileSelect.template +++ b/pki/dogtag/ca-ui/shared/webapps/ca/ee/ca/ProfileSelect.template @@ -441,6 +441,8 @@ document.writeln('<input type=hidden name=profileId value="' + profileId + '">'); document.writeln('<input type=hidden name=renewal value="' + renewal + '">'); +document.writeln('<input type=hidden name=xmlOutput value="' + + xmlOutput + '">'); } else { document.write('Sorry, your request is not submitted. The error code is "' + errorReason + '".'); } diff --git a/pki/dogtag/common/pki-common.spec b/pki/dogtag/common/pki-common.spec index 7546b21a..b33d65fb 100644 --- a/pki/dogtag/common/pki-common.spec +++ b/pki/dogtag/common/pki-common.spec @@ -34,7 +34,7 @@ ## Package Header Definitions %define base_name %{base_prefix}-%{base_component} %define base_version 1.0.0 -%define base_release 33 +%define base_release 34 %define base_group System Environment/Base %define base_vendor Red Hat, Inc. %define base_license GPLv2 with exceptions @@ -280,6 +280,9 @@ chmod 00755 %{_datadir}/%{base_prefix}/setup/postinstall ############################################################################### %changelog +* Wed Jan 28 2009 Christina Fu <cfu@redhat.com> 1.0.0-34 +- Bugzilla Bug #482733 - make outputXML available via profiles; add request id i +n response for deferred * Tue Jan 27 2009 Ade Lee <alee@redhat.com> 1.0.0-33 - Bugzilla Bugs: 482738 and 482761 * Mon Jan 26 2009 Andrew Wnuk <awnuk@redhat.com> 1.0.0-32 |