Hello Juan Hernandez,

I'd like you to do a code review.  Please visit

    http://gerrit.ovirt.org/31526

to review the following change.

Change subject: restapi: Remove trailing slashes from RSDL prefix
......................................................................

restapi: Remove trailing slashes from RSDL prefix

The RSDL document is loaded lazily, as part of the first request to the
RESTAPI. The prefix used to build the "href" attributes is extracted
from the path of this first request, and depending on that request it
may or may not contain a trailing slash. To make sure that the RSDL has
always the same content we need to remove any trailing slashes from the
prefix before using it.

Change-Id: Ieac656924ca999ddc9abc502e3fc6c23537e4769
Bug-Url: https://bugzilla.redhat.com/1122591
Signed-off-by: Juan Hernandez <[email protected]>
---
M 
backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/rsdl/RsdlManager.java
1 file changed, 5 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/26/31526/1

diff --git 
a/backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/rsdl/RsdlManager.java
 
b/backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/rsdl/RsdlManager.java
index ecbe998..806faa6 100644
--- 
a/backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/rsdl/RsdlManager.java
+++ 
b/backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/rsdl/RsdlManager.java
@@ -85,6 +85,11 @@
                 applicationMode == ApplicationMode.GlusterOnly ? ("/" + 
RsdlIOManager.GLUSTER_RSDL_RESOURCE_NAME)
                         : ("/" + RsdlIOManager.RSDL_RESOURCE_NAME);
 
+        // During runtime the RSDL document is loaded lazily, and the prefix 
is extracted from the request URL. As a
+        // result, depending on what URL is requested first, it may contain 
trailing slashes. So to make sure that the
+        // RSDL document will always be the same we need to explicitly remove 
the trailing slashes.
+        prefix = prefix.replaceAll("/+$", "");
+
         // Load the RSDL document into a DOM tree and then modify all the 
"href" attributes to include the prefix given
         // as parameter:
         Document document;


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ieac656924ca999ddc9abc502e3fc6c23537e4769
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: ovirt-engine-3.5
Gerrit-Owner: Ravi Nori <[email protected]>
Gerrit-Reviewer: Juan Hernandez <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to