You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by tw...@apache.org on 2016/08/08 08:21:07 UTC

[3/3] flink git commit: [FLINK-4304] [runtime-web] Jar names that contain whitespace cause problems in web client

[FLINK-4304] [runtime-web] Jar names that contain whitespace cause problems in web client

This closes #2327.


Project: http://git-wip-us.apache.org/repos/asf/flink/repo
Commit: http://git-wip-us.apache.org/repos/asf/flink/commit/8d25c641
Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/8d25c641
Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/8d25c641

Branch: refs/heads/master
Commit: 8d25c64146ef0a2d0e9ee4c3e8ac3229e72a1416
Parents: c9b0dad
Author: twalthr <tw...@apache.org>
Authored: Tue Aug 2 14:53:30 2016 +0200
Committer: twalthr <tw...@apache.org>
Committed: Mon Aug 8 10:19:14 2016 +0200

----------------------------------------------------------------------
 .../webmonitor/RuntimeMonitorHandler.java       |   8 +-
 .../scripts/modules/submit/submit.svc.coffee    |   6 +-
 flink-runtime-web/web-dashboard/web/js/index.js | 232 +++++++++----------
 .../web-dashboard/web/js/vendor.js              |   8 +-
 4 files changed, 130 insertions(+), 124 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flink/blob/8d25c641/flink-runtime-web/src/main/java/org/apache/flink/runtime/webmonitor/RuntimeMonitorHandler.java
----------------------------------------------------------------------
diff --git a/flink-runtime-web/src/main/java/org/apache/flink/runtime/webmonitor/RuntimeMonitorHandler.java b/flink-runtime-web/src/main/java/org/apache/flink/runtime/webmonitor/RuntimeMonitorHandler.java
index 6816440..b02e556 100644
--- a/flink-runtime-web/src/main/java/org/apache/flink/runtime/webmonitor/RuntimeMonitorHandler.java
+++ b/flink-runtime-web/src/main/java/org/apache/flink/runtime/webmonitor/RuntimeMonitorHandler.java
@@ -29,6 +29,7 @@ import io.netty.handler.codec.http.HttpVersion;
 import io.netty.handler.codec.http.router.KeepAliveWrite;
 import io.netty.handler.codec.http.router.Routed;
 
+import java.net.URLDecoder;
 import org.apache.flink.runtime.instance.ActorGateway;
 import org.apache.flink.runtime.webmonitor.handlers.RequestHandler;
 import org.apache.flink.util.ExceptionUtils;
@@ -82,10 +83,15 @@ public class RuntimeMonitorHandler extends RuntimeMonitorHandlerBase {
 				queryParams.put(key, routed.queryParam(key));
 			}
 
+			Map<String, String> pathParams = new HashMap<>(routed.pathParams().size());
+			for (String key : routed.pathParams().keySet()) {
+				pathParams.put(key, URLDecoder.decode(routed.pathParams().get(key), ENCODING.toString()));
+			}
+
 			InetSocketAddress address = (InetSocketAddress) ctx.channel().localAddress();
 			queryParams.put(WEB_MONITOR_ADDRESS_KEY, address.getHostName() + ":" + address.getPort());
 
-			String result = handler.handleRequest(routed.pathParams(), queryParams, jobManager);
+			String result = handler.handleRequest(pathParams, queryParams, jobManager);
 			byte[] bytes = result.getBytes(ENCODING);
 
 			response = new DefaultFullHttpResponse(

http://git-wip-us.apache.org/repos/asf/flink/blob/8d25c641/flink-runtime-web/web-dashboard/app/scripts/modules/submit/submit.svc.coffee
----------------------------------------------------------------------
diff --git a/flink-runtime-web/web-dashboard/app/scripts/modules/submit/submit.svc.coffee b/flink-runtime-web/web-dashboard/app/scripts/modules/submit/submit.svc.coffee
index 33e57a2..0f2cb96 100644
--- a/flink-runtime-web/web-dashboard/app/scripts/modules/submit/submit.svc.coffee
+++ b/flink-runtime-web/web-dashboard/app/scripts/modules/submit/submit.svc.coffee
@@ -32,7 +32,7 @@ angular.module('flinkApp')
   @deleteJar = (id) ->
     deferred = $q.defer()
 
-    $http.delete("jars/" + id)
+    $http.delete("jars/" + encodeURIComponent(id))
     .success (data, status, headers, config) ->
        deferred.resolve(data)
 
@@ -41,7 +41,7 @@ angular.module('flinkApp')
   @getPlan = (id, args) ->
     deferred = $q.defer()
 
-    $http.get("jars/" + id + "/plan", {params: args})
+    $http.get("jars/" + encodeURIComponent(id) + "/plan", {params: args})
     .success (data, status, headers, config) ->
       deferred.resolve(data)
 
@@ -50,7 +50,7 @@ angular.module('flinkApp')
   @runJob = (id, args) ->
     deferred = $q.defer()
 
-    $http.post("jars/" + id + "/run", {}, {params: args})
+    $http.post("jars/" + encodeURIComponent(id) + "/run", {}, {params: args})
     .success (data, status, headers, config) ->
       deferred.resolve(data)