Fix encoding/decoding of dashboard ids (one more time)

The encoding of the dashboard id on client side is done by
URL.encode(...). This method is not encoding the URL component
delimiter characters (e.g. '/'). This means if the dashboard ref
contains '/' it is not encoded and as result the RestApiServlet on the
server interprets '/' as seperator for the rest collections and the
loading of the dashboard fails.

When the dashboard URL is encoded on the server side by Url.encode(...)
space is encoded as '+'. Decoding this on the client side in Dispatcher
with URL.decodePathSegment(...) will not decode '+' to space.

Instead we need to use URL.decodeQueryString(...) which makes sure to
decode '+' to space.

The encoding on client side should be consistent with the decoding,
this is why URL.encodeQueryString(...) is used to encode the dashboard
id.

With the new encoding/decoding loading dashboards that contain '/' in
their ref or path succeeds as well as loading dashboards that have
spaces in their path.

Change-Id: I4c17bd6caf517faf68b71d39656229af4eb87e99
Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
2 files changed