Greg Sheremeta has uploaded a new change for review. Change subject: userportal, webadmin: fix 404 regression for help files ......................................................................
userportal, webadmin: fix 404 regression for help files Patch http://gerrit.ovirt.org/#/c/21052/ introduced a regression where if no help mapping json files are found, a 404 is served to the UI and logged. This fixes that by sending back an empty JSON string. There was also a path mapping bug in patch http://gerrit.ovirt.org/#/c/21052/ and this fixes that as well. Change-Id: I219e986ac45e7a05801bd9b519a006a429e5f82f Signed-off-by: Greg Sheremeta <[email protected]> --- M backend/manager/modules/docs/src/main/java/org/ovirt/engine/docs/utils/servlet/HelpTagJsonServlet.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/Configurator.java M frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/uicommon/UserPortalConfigurator.java M frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/uicommon/WebAdminConfigurator.java 4 files changed, 18 insertions(+), 9 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/12/24212/1 diff --git a/backend/manager/modules/docs/src/main/java/org/ovirt/engine/docs/utils/servlet/HelpTagJsonServlet.java b/backend/manager/modules/docs/src/main/java/org/ovirt/engine/docs/utils/servlet/HelpTagJsonServlet.java index 5894b8d..2a56f94 100644 --- a/backend/manager/modules/docs/src/main/java/org/ovirt/engine/docs/utils/servlet/HelpTagJsonServlet.java +++ b/backend/manager/modules/docs/src/main/java/org/ovirt/engine/docs/utils/servlet/HelpTagJsonServlet.java @@ -113,15 +113,14 @@ @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { Matcher m = REQUEST_PATTERN.matcher(request.getRequestURI()); + String content = "{}"; //$NON-NLS-1$ if (m.matches() && cachedJson.containsKey(m.group(REQUEST_PATTERN_KEY_GROUP))) { - response.setContentType("application/json"); //$NON-NLS-1$ - PrintStream printStream = new PrintStream(response.getOutputStream()); - printStream.print(cachedJson.get(m.group(REQUEST_PATTERN_KEY_GROUP))); - printStream.flush(); + content = cachedJson.get(m.group(REQUEST_PATTERN_KEY_GROUP)); } - else { - response.sendError(HttpServletResponse.SC_NOT_FOUND); - } + response.setContentType("application/json"); //$NON-NLS-1$ + PrintStream printStream = new PrintStream(response.getOutputStream()); + printStream.print(content); + printStream.flush(); } protected static JsonNode merge(JsonNode destination, JsonNode source) { diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/Configurator.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/Configurator.java index f14ee6c..11680b2 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/Configurator.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/Configurator.java @@ -27,6 +27,8 @@ private static final String DOCUMENTATION_LIB_PATH = "html/"; //$NON-NLS-1$ private static final String DOCUMENTATION_ROOT = BaseContextPathData.getInstance().getRelativePath() + "docs/manual"; //$NON-NLS-1$ + private static final String HELPTAG_MAPPING_ROOT = BaseContextPathData.getInstance().getRelativePath() + + "docs/manual/helptag"; //$NON-NLS-1$ private static String documentationLangPath; @@ -183,6 +185,14 @@ } /** + * Returns the base URL for serving helptag mapping files. + * @return helptag mapping base URL, including the trailing slash. + */ + public String getHelpTagMappingBaseURL() { + return FrontendUrlUtils.getRootURL() + HELPTAG_MAPPING_ROOT + "/"; //$NON-NLS-1$ + } + + /** * Returns the base URL for serving locale-specific HTML documentation. * <p> * Example: <code>http://www.example.com/docs/en-US/html/</code> diff --git a/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/uicommon/UserPortalConfigurator.java b/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/uicommon/UserPortalConfigurator.java index 1e8b4ae..9cb9dc4 100644 --- a/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/uicommon/UserPortalConfigurator.java +++ b/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/uicommon/UserPortalConfigurator.java @@ -153,7 +153,7 @@ protected void fetchDocumentationFile() { // TODO: don't hardcode userportal application name here - fetchFile(getDocumentationBaseURL() + "userportal.json", documentationFileFetchedEvent); //$NON-NLS-1$ + fetchFile(getHelpTagMappingBaseURL() + "userportal.json", documentationFileFetchedEvent); //$NON-NLS-1$ } } diff --git a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/uicommon/WebAdminConfigurator.java b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/uicommon/WebAdminConfigurator.java index 1c1dbb0..3629701 100644 --- a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/uicommon/WebAdminConfigurator.java +++ b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/uicommon/WebAdminConfigurator.java @@ -100,7 +100,7 @@ protected void fetchDocumentationFile() { // TODO: don't hard code webadmin application name here - fetchFile(getDocumentationBaseURL() + "webadmin.json", documentationFileFetchedEvent); //$NON-NLS-1$ + fetchFile(getHelpTagMappingBaseURL() + "webadmin.json", documentationFileFetchedEvent); //$NON-NLS-1$ } } -- To view, visit http://gerrit.ovirt.org/24212 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I219e986ac45e7a05801bd9b519a006a429e5f82f Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Greg Sheremeta <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
