You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@storm.apache.org by pt...@apache.org on 2014/04/09 23:39:36 UTC

[3/4] git commit: Ensure that also the topology id is encoded/decoded correctly

Ensure that also the topology id is encoded/decoded correctly


Project: http://git-wip-us.apache.org/repos/asf/incubator-storm/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-storm/commit/2c636ba0
Tree: http://git-wip-us.apache.org/repos/asf/incubator-storm/tree/2c636ba0
Diff: http://git-wip-us.apache.org/repos/asf/incubator-storm/diff/2c636ba0

Branch: refs/heads/master
Commit: 2c636ba017a8b67eceb11a8b09caf081812752b0
Parents: df687cb
Author: Niels Basjes <nb...@bol.com>
Authored: Mon Mar 24 22:07:27 2014 +0100
Committer: Niels Basjes <nb...@bol.com>
Committed: Mon Mar 24 22:07:27 2014 +0100

----------------------------------------------------------------------
 storm-core/src/clj/backtype/storm/ui/core.clj | 21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-storm/blob/2c636ba0/storm-core/src/clj/backtype/storm/ui/core.clj
----------------------------------------------------------------------
diff --git a/storm-core/src/clj/backtype/storm/ui/core.clj b/storm-core/src/clj/backtype/storm/ui/core.clj
index 3b975c5..ad4b97f 100644
--- a/storm-core/src/clj/backtype/storm/ui/core.clj
+++ b/storm-core/src/clj/backtype/storm/ui/core.clj
@@ -1016,34 +1016,40 @@
        (-> (main-page)
            ui-template))
   (GET "/topology/:id" [:as {cookies :cookies} id & m]
-       (let [include-sys? (get-include-sys? cookies)]
+       (let [include-sys? (get-include-sys? cookies)
+            id (java.net.URLDecoder/decode id)]
          (try
            (-> (topology-page id (:window m) include-sys?)
              (concat [(mk-system-toggle-button include-sys?)])
              ui-template)
            (catch Exception e (resp/redirect "/")))))
   (GET "/topology/:id/component/:component" [:as {cookies :cookies} id component & m]
-       (let [include-sys? (get-include-sys? cookies)]
-         (-> (component-page id (java.net.URLDecoder/decode component) (:window m) include-sys?)
+       (let [include-sys? (get-include-sys? cookies)
+            id (java.net.URLDecoder/decode id)
+            component (java.net.URLDecoder/decode component)]
+         (-> (component-page id component (:window m) include-sys?)
              (concat [(mk-system-toggle-button include-sys?)])
              ui-template)))
   (POST "/topology/:id/activate" [id]
     (with-nimbus nimbus
-      (let [tplg (.getTopologyInfo ^Nimbus$Client nimbus id)
+      (let [id (java.net.URLDecoder/decode id)
+            tplg (.getTopologyInfo ^Nimbus$Client nimbus id)
             name (.get_name tplg)]
         (.activate nimbus name)
         (log-message "Activating topology '" name "'")))
     (resp/redirect (str "/topology/" id)))
   (POST "/topology/:id/deactivate" [id]
     (with-nimbus nimbus
-      (let [tplg (.getTopologyInfo ^Nimbus$Client nimbus id)
+      (let [id (java.net.URLDecoder/decode id)
+            tplg (.getTopologyInfo ^Nimbus$Client nimbus id)
             name (.get_name tplg)]
         (.deactivate nimbus name)
         (log-message "Deactivating topology '" name "'")))
     (resp/redirect (str "/topology/" id)))
   (POST "/topology/:id/rebalance/:wait-time" [id wait-time]
     (with-nimbus nimbus
-      (let [tplg (.getTopologyInfo ^Nimbus$Client nimbus id)
+      (let [id (java.net.URLDecoder/decode id)
+            tplg (.getTopologyInfo ^Nimbus$Client nimbus id)
             name (.get_name tplg)
             options (RebalanceOptions.)]
         (.set_wait_secs options (Integer/parseInt wait-time))
@@ -1052,7 +1058,8 @@
     (resp/redirect (str "/topology/" id)))
   (POST "/topology/:id/kill/:wait-time" [id wait-time]
     (with-nimbus nimbus
-      (let [tplg (.getTopologyInfo ^Nimbus$Client nimbus id)
+      (let [id (java.net.URLDecoder/decode id)
+            tplg (.getTopologyInfo ^Nimbus$Client nimbus id)
             name (.get_name tplg)
             options (KillOptions.)]
         (.set_wait_secs options (Integer/parseInt wait-time))