Alexander Wels has uploaded a new change for review.

Change subject: engine: docs other languages
......................................................................

engine: docs other languages

- If you try to load a manual document in a locale that
  doesn't exist, you will get a 404 instead of a warning
  message that the language is not available.
- Fixed issue in the path of the link that would forward
  you to the english documentation.
- Fixed issue in the cookie path that would store if you
  had been shown the warning message yet.

Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1083528

Change-Id: Iaa26e9a95eff3aa117517ec53d3d97c8ac5ba703
Signed-off-by: Alexander Wels <[email protected]>
---
M 
backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/servlet/DocsServlet.java
1 file changed, 5 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/68/26368/1

diff --git 
a/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/servlet/DocsServlet.java
 
b/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/servlet/DocsServlet.java
index f9f9c04..6ffa032 100644
--- 
a/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/servlet/DocsServlet.java
+++ 
b/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/servlet/DocsServlet.java
@@ -58,12 +58,13 @@
                     && 
!file.getAbsolutePath().equals(replaceLocaleWithOtherLocale(originalFile.getAbsolutePath(),
                             locale, locale))) {
                 //We determined that we are going to redirect the user to the 
English version URI.
-                String redirect = request.getServletPath() + 
replaceLocaleWithUSLocale(request.getPathInfo(), locale);
+                String redirect = getServletContext().getContextPath() + 
request.getServletPath()
+                        + replaceLocaleWithUSLocale(request.getPathInfo(), 
locale);
                 if (!languagePageShown) {
                     setLangPageShown(response, true);
                     request.setAttribute(LocaleFilter.LOCALE, locale);
                     request.setAttribute(ENGLISH_HREF, redirect);
-                    final ServletContext forwardContext = 
getServletContext().getContext(localeDocsMissing);
+                    final ServletContext forwardContext = getServletContext();
                     if (forwardContext != null) {
                         final RequestDispatcher dispatcher = 
forwardContext.getRequestDispatcher(localeDocsMissing);
                         if (dispatcher != null) {
@@ -107,7 +108,8 @@
     private void setLangPageShown(HttpServletResponse response, boolean value) 
{
         Cookie cookie = new Cookie(LANG_PAGE_SHOWN, Boolean.toString(value));
         // Scope this cookie to the (root) application context URL
-        cookie.setPath("/" + getServletContext().getContextPath());
+        cookie.setPath(getServletContext().getContextPath());
+        cookie.setHttpOnly(true);
         // Don't set max age, i.e. let this be a session cookie
         response.addCookie(cookie);
     }


-- 
To view, visit http://gerrit.ovirt.org/26368
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iaa26e9a95eff3aa117517ec53d3d97c8ac5ba703
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Alexander Wels <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to