Alon Bar-Lev has uploaded a new change for review.

Change subject: utils: ForwardServlet: fix generic forward to use path info
......................................................................

utils: ForwardServlet: fix generic forward to use path info

requestURI is no good as we may need to forward into different uris.

Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=961677
Change-Id: I7307d57792fb966c8acb6ac0bdcad9302c0e3a65
Signed-off-by: Alon Bar-Lev <[email protected]>
---
M backend/manager/modules/services/src/main/webapp/WEB-INF/web.xml
M 
backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/servlet/ForwardServlet.java
2 files changed, 3 insertions(+), 11 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/84/20784/1

diff --git a/backend/manager/modules/services/src/main/webapp/WEB-INF/web.xml 
b/backend/manager/modules/services/src/main/webapp/WEB-INF/web.xml
index 1d07e66..2cb0860 100644
--- a/backend/manager/modules/services/src/main/webapp/WEB-INF/web.xml
+++ b/backend/manager/modules/services/src/main/webapp/WEB-INF/web.xml
@@ -70,7 +70,7 @@
   </servlet>
   <servlet-mapping>
     <servlet-name>health</servlet-name>
-    <url-pattern>/health</url-pattern>
+    <url-pattern>/health/*</url-pattern>
   </servlet-mapping>
 
   <!-- PageNotFoundForward Servlet -->
diff --git 
a/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/servlet/ForwardServlet.java
 
b/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/servlet/ForwardServlet.java
index 4e663e6..08cddef 100644
--- 
a/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/servlet/ForwardServlet.java
+++ 
b/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/servlet/ForwardServlet.java
@@ -59,11 +59,6 @@
      */
     public static final String URI_PARAM = "uri"; //$NON-NLS-1$
     /**
-     * The URI parameter that will simply try to forward the request path to 
the new context without any additional
-     * URI suffix.
-     */
-    public static final String ALL = "*"; //$NON-NLS-1$
-    /**
      * Init param prefix for adding attributes.
      */
     public static final String ATTR_PREF = "attr-";
@@ -90,9 +85,6 @@
         }
         if (targetContext == null) {
             throw new ServletException("Target context not defined in 
web.xml"); //$NON-NLS-1$
-        }
-        if (uri == null) {
-            uri = ALL;
         }
     }
 
@@ -122,8 +114,8 @@
         final ServletContext forwardContext = 
getServletContext().getContext(targetContext);
         if (forwardContext != null) {
             String forwardUri = uri;
-            if (ALL.equals(uri)) {
-                forwardUri = request.getRequestURI();
+            if (request.getPathInfo() != null) {
+                forwardUri += request.getPathInfo();
             }
             final RequestDispatcher dispatcher = 
forwardContext.getRequestDispatcher(forwardUri);
             if (dispatcher != null) {


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

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

Reply via email to