Skip to content

Commit

Permalink
[FLINK-4304] [runtime-web] Jar names that contain whitespace cause pr…
Browse files Browse the repository at this point in the history
…oblems in web client

This closes apache#2327.
  • Loading branch information
twalthr committed Aug 8, 2016
1 parent c9b0dad commit 8d25c64
Show file tree
Hide file tree
Showing 4 changed files with 130 additions and 124 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
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;
Expand Down Expand Up @@ -82,10 +83,15 @@ protected void respondAsLeader(ChannelHandlerContext ctx, Routed routed, ActorGa
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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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)

Expand All @@ -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)

Expand Down
232 changes: 116 additions & 116 deletions flink-runtime-web/web-dashboard/web/js/index.js

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions flink-runtime-web/web-dashboard/web/js/vendor.js

Large diffs are not rendered by default.

0 comments on commit 8d25c64

Please sign in to comment.