{"action":"created","comment":{"url":"https://api.github.com/repos/apache/flink/pulls/comments/45088463","id":45088463,"diff_hunk":"@@ -0,0 +1,130 @@\n+/*\n+ * Licensed to the Apache Software Foundation (ASF) under one\n+ * or more contributor license agreements.  See the NOTICE file\n+ * distributed with this work for additional information\n+ * regarding copyright ownership.  The ASF licenses this file\n+ * to you under the Apache License, Version 2.0 (the\n+ * \"License\"); you may not use this file except in compliance\n+ * with the License.  You may obtain a copy of the License at\n+ *\n+ *     http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+\n+package org.apache.flink.runtime.webmonitor.handlers;\n+\n+import com.fasterxml.jackson.core.JsonGenerator;\n+import org.apache.flink.client.program.PackagedProgram;\n+import org.apache.flink.client.program.ProgramInvocationException;\n+import org.apache.flink.runtime.instance.ActorGateway;\n+import org.apache.flink.runtime.webmonitor.RuntimeMonitorHandler;\n+\n+import java.io.File;\n+import java.io.FilenameFilter;\n+import java.io.IOException;\n+import java.io.StringWriter;\n+import java.util.Map;\n+import java.util.UUID;\n+import java.util.jar.JarFile;\n+import java.util.jar.Manifest;\n+\n+public class JarListHandler implements RequestHandler, RequestHandler.JsonResponse {\n+\n+\tprivate final File jarDir;\n+\n+\tpublic  JarListHandler(File jarDirectory) {\n+\t\tjarDir = jarDirectory;\n+\t}\n+\n+\t@Override\n+\tpublic String handleRequest(Map<String, String> params, ActorGateway jobManager) throws Exception {\n+\t\ttry {\n+\t\t\tStringWriter writer = new StringWriter();\n+\t\t\tJsonGenerator gen = JsonFactory.jacksonFactory.createJsonGenerator(writer);\n+\t\t\tgen.writeStartObject();\n+\t\t\tgen.writeStringField(\"address\", params.get(RuntimeMonitorHandler.WEB_MONITOR_ADDRESS_KEY));\n+\t\t\tif (jarDir != null) {","path":"flink-runtime-web/src/main/java/org/apache/flink/runtime/webmonitor/handlers/JarListHandler.java","position":51,"original_position":51,"commit_id":"37c46adb985d5ed3bfcedaf3aff7a922ab0c0903","original_commit_id":"37c46adb985d5ed3bfcedaf3aff7a922ab0c0903","user":{"login":"rmetzger","id":89049,"avatar_url":"https://avatars.githubusercontent.com/u/89049?v=3","gravatar_id":"","url":"https://api.github.com/users/rmetzger","html_url":"https://github.com/rmetzger","followers_url":"https://api.github.com/users/rmetzger/followers","following_url":"https://api.github.com/users/rmetzger/following{/other_user}","gists_url":"https://api.github.com/users/rmetzger/gists{/gist_id}","starred_url":"https://api.github.com/users/rmetzger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rmetzger/subscriptions","organizations_url":"https://api.github.com/users/rmetzger/orgs","repos_url":"https://api.github.com/users/rmetzger/repos","events_url":"https://api.github.com/users/rmetzger/events{/privacy}","received_events_url":"https://api.github.com/users/rmetzger/received_events","type":"User","site_admin":false},"body":"I'm not sure if this is a good way of protecting a security relevant code section.\r\nMaybe it would make more sense to pass a boolean which controls if we can execute this section?","created_at":"2015-11-17T17:14:11Z","updated_at":"2015-11-17T17:14:11Z","html_url":"https://github.com/apache/flink/pull/1338#discussion_r45088463","pull_request_url":"https://api.github.com/repos/apache/flink/pulls/1338","_links":{"self":{"href":"https://api.github.com/repos/apache/flink/pulls/comments/45088463"},"html":{"href":"https://github.com/apache/flink/pull/1338#discussion_r45088463"},"pull_request":{"href":"https://api.github.com/repos/apache/flink/pulls/1338"}}},"pull_request":{"url":"https://api.github.com/repos/apache/flink/pulls/1338","id":50060397,"html_url":"https://github.com/apache/flink/pull/1338","diff_url":"https://github.com/apache/flink/pull/1338.diff","patch_url":"https://github.com/apache/flink/pull/1338.patch","issue_url":"https://api.github.com/repos/apache/flink/issues/1338","number":1338,"state":"open","locked":false,"title":"[FLINK-2978][web-dashboard][webclient] Integrate web client into Web Frontend","user":{"login":"sachingoel0101","id":8874261,"avatar_url":"https://avatars.githubusercontent.com/u/8874261?v=3","gravatar_id":"","url":"https://api.github.com/users/sachingoel0101","html_url":"https://github.com/sachingoel0101","followers_url":"https://api.github.com/users/sachingoel0101/followers","following_url":"https://api.github.com/users/sachingoel0101/following{/other_user}","gists_url":"https://api.github.com/users/sachingoel0101/gists{/gist_id}","starred_url":"https://api.github.com/users/sachingoel0101/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sachingoel0101/subscriptions","organizations_url":"https://api.github.com/users/sachingoel0101/orgs","repos_url":"https://api.github.com/users/sachingoel0101/repos","events_url":"https://api.github.com/users/sachingoel0101/events{/privacy}","received_events_url":"https://api.github.com/users/sachingoel0101/received_events","type":"User","site_admin":false},"body":"This PR creates an interface on the dashboard to perform the tasks the webclient is doing right now, including displaying plans, submitting jobs and uploading jars.\r\n\r\nHere's a quick summary of changes:\r\n1. GET `/jars/list`: List of all available jars\r\n2. GET `/jars/:jarid/plan`: Plan for a job. Takes `entry-class`, `parallelism` and `program-args` as query parameters.\r\n3. DELETE `/jars/:jarid`: Delete a jar.\r\n4. POST `/jars/upload`: Upload a new jar, limited to 10 MB size. \r\n5. POST `/jars/:jarid/run`: Run a jar, and takes arguments just as in GET `/jars/:jarid/plan`.\r\n\r\nA new state is introduced on the dashboard, named `submit` which allows all these operations.\r\n\r\nDetailed screenshots:\r\n1. Overview page:\r\n\r\n![overview](https://cloud.githubusercontent.com/assets/8874261/11020609/3ed0b3e4-864a-11e5-8832-a689ac725bcf.png)\r\n\r\n2. Disabled mode [via config key `jobmanager.web.submit.allow`], for security purposes:\r\n\r\n![disabled](https://cloud.githubusercontent.com/assets/8874261/11020610/65a29f46-864a-11e5-8fbf-c7d8c05e9803.png)\r\n\r\n3. Default state with no jars:\r\n\r\n![no_jars_uploaded](https://cloud.githubusercontent.com/assets/8874261/11020613/71e0b824-864a-11e5-9b53-29d3325f0d65.png)\r\n\r\n4. Uploading a jar:\r\n\r\n![uploading](https://cloud.githubusercontent.com/assets/8874261/11020616/7df20802-864a-11e5-8c4b-2fc1bd796e40.png)\r\n\r\n5. Arguments passing interface for the programs. This is shown only when a Jar has been selected. At this point, the upload new button disappears, which can be brought back again by unselecting.\r\nEntry classes can be loaded to the `entry-class` input box by clicking on the list items under Entry Class.\r\n\r\n![argument_passing_interface](https://cloud.githubusercontent.com/assets/8874261/11020622/b1aa81f6-864a-11e5-93ac-100e7fb06564.png)\r\n\r\n\r\n6. Plan, as a result of `Show Plan` button:\r\n\r\n![plan](https://cloud.githubusercontent.com/assets/8874261/11020626/c8e172a8-864a-11e5-9c26-fa12e57edabc.png)\r\n\r\n7. Error reporting:\r\nInvalid entry class:\r\n\r\n![invalid_entry_class](https://cloud.githubusercontent.com/assets/8874261/11020632/fbb36f4c-864a-11e5-98c0-3f98caf8ecfd.png)\r\n\r\nInvalid parallelism:\r\n\r\n![invalid_parallelism](https://cloud.githubusercontent.com/assets/8874261/11020633/0d6f2172-864b-11e5-8ac7-b5bfa22db56f.png)\r\n\r\n\r\n8. After clicking on submit, if the job was submitted successfully, it automatically redirects to that job's page.\r\n\r\n![transition_to_job_after_submit](https://cloud.githubusercontent.com/assets/8874261/11020635/291ec12a-864b-11e5-9d69-37dd9de693b0.png)\r\n\r\n9. Program arguments:\r\n\r\n![program_args](https://cloud.githubusercontent.com/assets/8874261/11020637/338b30d0-864b-11e5-8797-0e24cc914a93.png)\r\n\r\n10. Invalid file uploads:\r\n\r\n![invalid_file_upload](https://cloud.githubusercontent.com/assets/8874261/11020641/447074dc-864b-11e5-907b-7fd80237ee7f.png)\r\n\r\n11. Disallow too large files:\r\n\r\n![max_limit_on_upload](https://cloud.githubusercontent.com/assets/8874261/11020644/54b9159c-864b-11e5-90e4-117173ece9a0.png)\r\n\r\n\r\nOf course, the best way to get the feel of it is to use it. :') Looking forward to comments and suggestions. ","created_at":"2015-11-08T13:36:19Z","updated_at":"2015-11-17T17:14:11Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e7c8396a47d44dd4a6dce2611ffedcc8ff635b00","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/apache/flink/pulls/1338/commits","review_comments_url":"https://api.github.com/repos/apache/flink/pulls/1338/comments","review_comment_url":"https://api.github.com/repos/apache/flink/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apache/flink/issues/1338/comments","statuses_url":"https://api.github.com/repos/apache/flink/statuses/37c46adb985d5ed3bfcedaf3aff7a922ab0c0903","head":{"label":"sachingoel0101:client","ref":"client","sha":"37c46adb985d5ed3bfcedaf3aff7a922ab0c0903","user":{"login":"sachingoel0101","id":8874261,"avatar_url":"https://avatars.githubusercontent.com/u/8874261?v=3","gravatar_id":"","url":"https://api.github.com/users/sachingoel0101","html_url":"https://github.com/sachingoel0101","followers_url":"https://api.github.com/users/sachingoel0101/followers","following_url":"https://api.github.com/users/sachingoel0101/following{/other_user}","gists_url":"https://api.github.com/users/sachingoel0101/gists{/gist_id}","starred_url":"https://api.github.com/users/sachingoel0101/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sachingoel0101/subscriptions","organizations_url":"https://api.github.com/users/sachingoel0101/orgs","repos_url":"https://api.github.com/users/sachingoel0101/repos","events_url":"https://api.github.com/users/sachingoel0101/events{/privacy}","received_events_url":"https://api.github.com/users/sachingoel0101/received_events","type":"User","site_admin":false},"repo":{"id":35545853,"name":"flink","full_name":"sachingoel0101/flink","owner":{"login":"sachingoel0101","id":8874261,"avatar_url":"https://avatars.githubusercontent.com/u/8874261?v=3","gravatar_id":"","url":"https://api.github.com/users/sachingoel0101","html_url":"https://github.com/sachingoel0101","followers_url":"https://api.github.com/users/sachingoel0101/followers","following_url":"https://api.github.com/users/sachingoel0101/following{/other_user}","gists_url":"https://api.github.com/users/sachingoel0101/gists{/gist_id}","starred_url":"https://api.github.com/users/sachingoel0101/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sachingoel0101/subscriptions","organizations_url":"https://api.github.com/users/sachingoel0101/orgs","repos_url":"https://api.github.com/users/sachingoel0101/repos","events_url":"https://api.github.com/users/sachingoel0101/events{/privacy}","received_events_url":"https://api.github.com/users/sachingoel0101/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/sachingoel0101/flink","description":"Mirror of Apache Flink","fork":true,"url":"https://api.github.com/repos/sachingoel0101/flink","forks_url":"https://api.github.com/repos/sachingoel0101/flink/forks","keys_url":"https://api.github.com/repos/sachingoel0101/flink/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sachingoel0101/flink/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sachingoel0101/flink/teams","hooks_url":"https://api.github.com/repos/sachingoel0101/flink/hooks","issue_events_url":"https://api.github.com/repos/sachingoel0101/flink/issues/events{/number}","events_url":"https://api.github.com/repos/sachingoel0101/flink/events","assignees_url":"https://api.github.com/repos/sachingoel0101/flink/assignees{/user}","branches_url":"https://api.github.com/repos/sachingoel0101/flink/branches{/branch}","tags_url":"https://api.github.com/repos/sachingoel0101/flink/tags","blobs_url":"https://api.github.com/repos/sachingoel0101/flink/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sachingoel0101/flink/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sachingoel0101/flink/git/refs{/sha}","trees_url":"https://api.github.com/repos/sachingoel0101/flink/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sachingoel0101/flink/statuses/{sha}","languages_url":"https://api.github.com/repos/sachingoel0101/flink/languages","stargazers_url":"https://api.github.com/repos/sachingoel0101/flink/stargazers","contributors_url":"https://api.github.com/repos/sachingoel0101/flink/contributors","subscribers_url":"https://api.github.com/repos/sachingoel0101/flink/subscribers","subscription_url":"https://api.github.com/repos/sachingoel0101/flink/subscription","commits_url":"https://api.github.com/repos/sachingoel0101/flink/commits{/sha}","git_commits_url":"https://api.github.com/repos/sachingoel0101/flink/git/commits{/sha}","comments_url":"https://api.github.com/repos/sachingoel0101/flink/comments{/number}","issue_comment_url":"https://api.github.com/repos/sachingoel0101/flink/issues/comments{/number}","contents_url":"https://api.github.com/repos/sachingoel0101/flink/contents/{+path}","compare_url":"https://api.github.com/repos/sachingoel0101/flink/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sachingoel0101/flink/merges","archive_url":"https://api.github.com/repos/sachingoel0101/flink/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sachingoel0101/flink/downloads","issues_url":"https://api.github.com/repos/sachingoel0101/flink/issues{/number}","pulls_url":"https://api.github.com/repos/sachingoel0101/flink/pulls{/number}","milestones_url":"https://api.github.com/repos/sachingoel0101/flink/milestones{/number}","notifications_url":"https://api.github.com/repos/sachingoel0101/flink/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sachingoel0101/flink/labels{/name}","releases_url":"https://api.github.com/repos/sachingoel0101/flink/releases{/id}","created_at":"2015-05-13T11:44:31Z","updated_at":"2015-05-13T11:44:41Z","pushed_at":"2015-11-15T14:23:11Z","git_url":"git://github.com/sachingoel0101/flink.git","ssh_url":"git@github.com:sachingoel0101/flink.git","clone_url":"https://github.com/sachingoel0101/flink.git","svn_url":"https://github.com/sachingoel0101/flink","homepage":null,"size":71236,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"apache:master","ref":"master","sha":"9a911c88ec4b11300d72f41a7c51569e1d228a87","user":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"repo":{"id":20587599,"name":"flink","full_name":"apache/flink","owner":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/apache/flink","description":"Mirror of Apache Flink","fork":false,"url":"https://api.github.com/repos/apache/flink","forks_url":"https://api.github.com/repos/apache/flink/forks","keys_url":"https://api.github.com/repos/apache/flink/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apache/flink/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apache/flink/teams","hooks_url":"https://api.github.com/repos/apache/flink/hooks","issue_events_url":"https://api.github.com/repos/apache/flink/issues/events{/number}","events_url":"https://api.github.com/repos/apache/flink/events","assignees_url":"https://api.github.com/repos/apache/flink/assignees{/user}","branches_url":"https://api.github.com/repos/apache/flink/branches{/branch}","tags_url":"https://api.github.com/repos/apache/flink/tags","blobs_url":"https://api.github.com/repos/apache/flink/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apache/flink/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apache/flink/git/refs{/sha}","trees_url":"https://api.github.com/repos/apache/flink/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apache/flink/statuses/{sha}","languages_url":"https://api.github.com/repos/apache/flink/languages","stargazers_url":"https://api.github.com/repos/apache/flink/stargazers","contributors_url":"https://api.github.com/repos/apache/flink/contributors","subscribers_url":"https://api.github.com/repos/apache/flink/subscribers","subscription_url":"https://api.github.com/repos/apache/flink/subscription","commits_url":"https://api.github.com/repos/apache/flink/commits{/sha}","git_commits_url":"https://api.github.com/repos/apache/flink/git/commits{/sha}","comments_url":"https://api.github.com/repos/apache/flink/comments{/number}","issue_comment_url":"https://api.github.com/repos/apache/flink/issues/comments{/number}","contents_url":"https://api.github.com/repos/apache/flink/contents/{+path}","compare_url":"https://api.github.com/repos/apache/flink/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apache/flink/merges","archive_url":"https://api.github.com/repos/apache/flink/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apache/flink/downloads","issues_url":"https://api.github.com/repos/apache/flink/issues{/number}","pulls_url":"https://api.github.com/repos/apache/flink/pulls{/number}","milestones_url":"https://api.github.com/repos/apache/flink/milestones{/number}","notifications_url":"https://api.github.com/repos/apache/flink/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apache/flink/labels{/name}","releases_url":"https://api.github.com/repos/apache/flink/releases{/id}","created_at":"2014-06-07T07:00:10Z","updated_at":"2015-11-17T10:58:31Z","pushed_at":"2015-11-17T15:14:27Z","git_url":"git://github.com/apache/flink.git","ssh_url":"git@github.com:apache/flink.git","clone_url":"https://github.com/apache/flink.git","svn_url":"https://github.com/apache/flink","homepage":null,"size":84592,"stargazers_count":738,"watchers_count":738,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":504,"mirror_url":"git://git.apache.org/incubator-flink.git","open_issues_count":81,"forks":504,"open_issues":81,"watchers":738,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/flink/pulls/1338"},"html":{"href":"https://github.com/apache/flink/pull/1338"},"issue":{"href":"https://api.github.com/repos/apache/flink/issues/1338"},"comments":{"href":"https://api.github.com/repos/apache/flink/issues/1338/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/flink/pulls/1338/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/flink/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apache/flink/pulls/1338/commits"},"statuses":{"href":"https://api.github.com/repos/apache/flink/statuses/37c46adb985d5ed3bfcedaf3aff7a922ab0c0903"}}}}