Repository: mesos
Updated Branches:
  refs/heads/master c1b11acaf -> 8f7e303df


Removed '.json' extension in files endpoints url.

Added HTTP files endpoints without the json extension.

Review: https://reviews.apache.org/r/36127


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

Branch: refs/heads/master
Commit: 8f7e303dfeeda7c553e06f0b4baa1779fad2f93f
Parents: f893c85
Author: Isabel Jimenez <[email protected]>
Authored: Fri Sep 11 22:28:16 2015 -0700
Committer: Adam B <[email protected]>
Committed: Sat Sep 12 02:21:32 2015 -0700

----------------------------------------------------------------------
 docs/configuration.md                     |  2 +-
 src/cli/mesos-cat                         |  4 +--
 src/cli/mesos-tail                        |  2 +-
 src/files/files.cpp                       | 15 +++++++++
 src/master/flags.cpp                      |  2 +-
 src/slave/flags.cpp                       |  2 +-
 src/tests/files_tests.cpp                 | 46 +++++++++++++-------------
 src/tests/gc_tests.cpp                    |  6 ++--
 src/webui/master/static/browse.html       |  2 +-
 src/webui/master/static/js/controllers.js |  2 +-
 10 files changed, 49 insertions(+), 34 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/8f7e303d/docs/configuration.md
----------------------------------------------------------------------
diff --git a/docs/configuration.md b/docs/configuration.md
index 315dc53..dd7f4aa 100644
--- a/docs/configuration.md
+++ b/docs/configuration.md
@@ -58,7 +58,7 @@ If you have special compilation requirements, please refer to 
`./configure --hel
 <pre><code>{
   "disabled_endpoints" : {
     "paths" : [
-      "/files/browse.json",
+      "/files/browse",
       "/slave(0)/stats.json",
     ]
   }

http://git-wip-us.apache.org/repos/asf/mesos/blob/8f7e303d/src/cli/mesos-cat
----------------------------------------------------------------------
diff --git a/src/cli/mesos-cat b/src/cli/mesos-cat
index 63a90d1..ddc5a26 100755
--- a/src/cli/mesos-cat
+++ b/src/cli/mesos-cat
@@ -61,7 +61,7 @@ def read(slave, task, file):
     try:
         result = json.loads(http.get(
             slave['pid'],
-            '/files/read.json',
+            '/files/read',
             {'path': path,
              'offset': -1}))
     except HTTPError as error:
@@ -80,7 +80,7 @@ def read(slave, task, file):
         try:
             result = json.loads(http.get(
                 slave['pid'],
-                '/files/read.json',
+                '/files/read',
                 {'path': path,
                  'offset': offset,
                  'length': PAGE_LENGTH}))

http://git-wip-us.apache.org/repos/asf/mesos/blob/8f7e303d/src/cli/mesos-tail
----------------------------------------------------------------------
diff --git a/src/cli/mesos-tail b/src/cli/mesos-tail
index 28e16b2..031ee25 100755
--- a/src/cli/mesos-tail
+++ b/src/cli/mesos-tail
@@ -55,7 +55,7 @@ def read_forever(slave, task, file):
     while True:
         try:
             result = json.loads(http.get(slave['pid'],
-                '/files/read.json',
+                '/files/read',
                 {'path': path,
                  'offset': offset,
                  'length': PAGE_LENGTH}))

http://git-wip-us.apache.org/repos/asf/mesos/blob/8f7e303d/src/files/files.cpp
----------------------------------------------------------------------
diff --git a/src/files/files.cpp b/src/files/files.cpp
index a8807b6..1d4b1e6 100644
--- a/src/files/files.cpp
+++ b/src/files/files.cpp
@@ -134,6 +134,8 @@ FilesProcess::FilesProcess()
 
 void FilesProcess::initialize()
 {
+  // TODO(ijimenez): Remove these endpoints at the end of the
+  // deprecation cycle on 0.26.
   route("/browse.json",
         FilesProcess::BROWSE_HELP,
         &FilesProcess::browse);
@@ -146,6 +148,19 @@ void FilesProcess::initialize()
   route("/debug.json",
         FilesProcess::DEBUG_HELP,
         &FilesProcess::debug);
+
+  route("/browse",
+        FilesProcess::BROWSE_HELP,
+        &FilesProcess::browse);
+  route("/read",
+        FilesProcess::READ_HELP,
+        &FilesProcess::read);
+  route("/download",
+        FilesProcess::DOWNLOAD_HELP,
+        &FilesProcess::download);
+  route("/debug",
+        FilesProcess::DEBUG_HELP,
+        &FilesProcess::debug);
 }
 
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/8f7e303d/src/master/flags.cpp
----------------------------------------------------------------------
diff --git a/src/master/flags.cpp b/src/master/flags.cpp
index 230c1dc..8087961 100644
--- a/src/master/flags.cpp
+++ b/src/master/flags.cpp
@@ -267,7 +267,7 @@ mesos::internal::master::Flags::Flags()
       "{\n"
       "  \"disabled_endpoints\" : {\n"
       "    \"paths\" : [\n"
-      "      \"/files/browse.json\",\n"
+      "      \"/files/browse\",\n"
       "      \"/slave(0)/stats.json\",\n"
       "    ]\n"
       "  }\n"

http://git-wip-us.apache.org/repos/asf/mesos/blob/8f7e303d/src/slave/flags.cpp
----------------------------------------------------------------------
diff --git a/src/slave/flags.cpp b/src/slave/flags.cpp
index b676bac..ff167ec 100644
--- a/src/slave/flags.cpp
+++ b/src/slave/flags.cpp
@@ -322,7 +322,7 @@ mesos::internal::slave::Flags::Flags()
       "{\n"
       "  \"disabled_endpoints\": {\n"
       "    \"paths\": [\n"
-      "      \"/files/browse.json\",\n"
+      "      \"/files/browse\",\n"
       "      \"/slave(0)/stats.json\",\n"
       "    ]\n"
       "  }\n"

http://git-wip-us.apache.org/repos/asf/mesos/blob/8f7e303d/src/tests/files_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/files_tests.cpp b/src/tests/files_tests.cpp
index 53771cd..4b13f5b 100644
--- a/src/tests/files_tests.cpp
+++ b/src/tests/files_tests.cpp
@@ -88,21 +88,21 @@ TEST_F(FilesTest, ReadTest)
   process::UPID upid("files", process::address());
 
   Future<Response> response =
-    process::http::get(upid, "read.json");
+    process::http::get(upid, "read");
 
   AWAIT_EXPECT_RESPONSE_STATUS_EQ(BadRequest().status, response);
   AWAIT_EXPECT_RESPONSE_BODY_EQ(
       "Expecting 'path=value' in query.\n",
       response);
 
-  response = process::http::get(upid, "read.json", "path=none&offset=hello");
+  response = process::http::get(upid, "read", "path=none&offset=hello");
 
   AWAIT_EXPECT_RESPONSE_STATUS_EQ(BadRequest().status, response);
   AWAIT_EXPECT_RESPONSE_BODY_EQ(
       "Failed to parse offset: Failed to convert 'hello' to number.\n",
       response);
 
-  response = process::http::get(upid, "read.json", "path=none&length=hello");
+  response = process::http::get(upid, "read", "path=none&length=hello");
 
   AWAIT_EXPECT_RESPONSE_STATUS_EQ(BadRequest().status, response);
   AWAIT_EXPECT_RESPONSE_BODY_EQ(
@@ -119,12 +119,12 @@ TEST_F(FilesTest, ReadTest)
   expected.values["offset"] = 0;
   expected.values["data"] = "body";
 
-  response = process::http::get(upid, "read.json", "path=/myname&offset=0");
+  response = process::http::get(upid, "read", "path=/myname&offset=0");
 
   AWAIT_EXPECT_RESPONSE_STATUS_EQ(OK().status, response);
   AWAIT_EXPECT_RESPONSE_BODY_EQ(stringify(expected), response);
 
-  response = process::http::get(upid, "read.json", "path=myname&offset=0");
+  response = process::http::get(upid, "read", "path=myname&offset=0");
 
   AWAIT_EXPECT_RESPONSE_STATUS_EQ(OK().status, response);
   AWAIT_EXPECT_RESPONSE_BODY_EQ(stringify(expected), response);
@@ -132,7 +132,7 @@ TEST_F(FilesTest, ReadTest)
   // Missing file.
   AWAIT_EXPECT_RESPONSE_STATUS_EQ(
       NotFound().status,
-      process::http::get(upid, "read.json", "path=missing"));
+      process::http::get(upid, "read", "path=missing"));
 }
 
 
@@ -158,38 +158,38 @@ TEST_F(FilesTest, ResolveTest)
   expected.values["data"] = "three";
 
   Future<Response> response =
-    process::http::get(upid, "read.json", "path=one/2/three&offset=0");
+    process::http::get(upid, "read", "path=one/2/three&offset=0");
 
   AWAIT_EXPECT_RESPONSE_STATUS_EQ(OK().status, response);
   AWAIT_EXPECT_RESPONSE_BODY_EQ(stringify(expected), response);
 
   response =
-    process::http::get(upid, "read.json", "path=/one/2/three&offset=0");
+    process::http::get(upid, "read", "path=/one/2/three&offset=0");
 
   AWAIT_EXPECT_RESPONSE_STATUS_EQ(OK().status, response);
   AWAIT_EXPECT_RESPONSE_BODY_EQ(stringify(expected), response);
 
   response =
-    process::http::get(upid, "read.json", "path=two/three&offset=0");
+    process::http::get(upid, "read", "path=two/three&offset=0");
 
   AWAIT_EXPECT_RESPONSE_STATUS_EQ(OK().status, response);
   AWAIT_EXPECT_RESPONSE_BODY_EQ(stringify(expected), response);
 
   response =
-    process::http::get(upid, "read.json", "path=one/two/three&offset=0");
+    process::http::get(upid, "read", "path=one/two/three&offset=0");
 
   AWAIT_EXPECT_RESPONSE_STATUS_EQ(OK().status, response);
   AWAIT_EXPECT_RESPONSE_BODY_EQ(stringify(expected), response);
 
   // Percent encoded '/' urls.
   response =
-    process::http::get(upid, "read.json", "path=%2Fone%2F2%2Fthree&offset=0");
+    process::http::get(upid, "read", "path=%2Fone%2F2%2Fthree&offset=0");
 
   AWAIT_EXPECT_RESPONSE_STATUS_EQ(OK().status, response);
   AWAIT_EXPECT_RESPONSE_BODY_EQ(stringify(expected), response);
 
   response =
-    process::http::get(upid, "read.json", "path=one%2Ftwo%2Fthree&offset=0");
+    process::http::get(upid, "read", "path=one%2Ftwo%2Fthree&offset=0");
 
   AWAIT_EXPECT_RESPONSE_STATUS_EQ(OK().status, response);
   AWAIT_EXPECT_RESPONSE_BODY_EQ(stringify(expected), response);
@@ -197,18 +197,18 @@ TEST_F(FilesTest, ResolveTest)
   // Reading dirs not allowed.
   AWAIT_EXPECT_RESPONSE_STATUS_EQ(
       BadRequest().status,
-      process::http::get(upid, "read.json", "path=one/2"));
+      process::http::get(upid, "read", "path=one/2"));
   AWAIT_EXPECT_RESPONSE_STATUS_EQ(
       BadRequest().status,
-      process::http::get(upid, "read.json", "path=one"));
+      process::http::get(upid, "read", "path=one"));
   AWAIT_EXPECT_RESPONSE_STATUS_EQ(
       BadRequest().status,
-      process::http::get(upid, "read.json", "path=one/"));
+      process::http::get(upid, "read", "path=one/"));
 
   // Breaking out of sandbox.
   AWAIT_EXPECT_RESPONSE_STATUS_EQ(
       BadRequest().status,
-      process::http::get(upid, "read.json", "path=two/../two"));
+      process::http::get(upid, "read", "path=two/../two"));
 }
 
 
@@ -237,23 +237,23 @@ TEST_F(FilesTest, BrowseTest)
   expected.values.push_back(jsonFileInfo("one/two", s));
 
   Future<Response> response =
-      process::http::get(upid, "browse.json", "path=one/");
+      process::http::get(upid, "browse", "path=one/");
 
   AWAIT_EXPECT_RESPONSE_STATUS_EQ(OK().status, response);
   AWAIT_EXPECT_RESPONSE_BODY_EQ(stringify(expected), response);
 
-  response = process::http::get(upid, "browse.json", "path=one%2F");
+  response = process::http::get(upid, "browse", "path=one%2F");
 
   AWAIT_EXPECT_RESPONSE_STATUS_EQ(OK().status, response);
   AWAIT_EXPECT_RESPONSE_BODY_EQ(stringify(expected), response);
 
-  response = process::http::get(upid, "browse.json", "path=one");
+  response = process::http::get(upid, "browse", "path=one");
 
   AWAIT_EXPECT_RESPONSE_STATUS_EQ(OK().status, response);
   AWAIT_EXPECT_RESPONSE_BODY_EQ(stringify(expected), response);
 
   // Empty listing.
-  response = process::http::get(upid, "browse.json", "path=one/2");
+  response = process::http::get(upid, "browse", "path=one/2");
 
   AWAIT_EXPECT_RESPONSE_STATUS_EQ(OK().status, response);
   AWAIT_EXPECT_RESPONSE_BODY_EQ(stringify(JSON::Array()), response);
@@ -261,7 +261,7 @@ TEST_F(FilesTest, BrowseTest)
   // Missing dir.
   AWAIT_EXPECT_RESPONSE_STATUS_EQ(
       NotFound().status,
-      process::http::get(upid, "browse.json", "path=missing"));
+      process::http::get(upid, "browse", "path=missing"));
 }
 
 
@@ -285,7 +285,7 @@ TEST_F(FilesTest, DownloadTest)
   AWAIT_EXPECT_READY(files.attach("black.gif", "black.gif"));
 
   Future<Response> response =
-    process::http::get(upid, "download.json", "path=binary");
+    process::http::get(upid, "download", "path=binary");
   AWAIT_EXPECT_RESPONSE_STATUS_EQ(OK().status, response);
   AWAIT_EXPECT_RESPONSE_HEADER_EQ(
       "application/octet-stream",
@@ -293,7 +293,7 @@ TEST_F(FilesTest, DownloadTest)
       response);
   AWAIT_EXPECT_RESPONSE_BODY_EQ("no file extension", response);
 
-  response = process::http::get(upid, "download.json", "path=black.gif");
+  response = process::http::get(upid, "download", "path=black.gif");
   AWAIT_EXPECT_RESPONSE_STATUS_EQ(OK().status, response);
   AWAIT_EXPECT_RESPONSE_HEADER_EQ("image/gif", "Content-Type", response);
   AWAIT_EXPECT_RESPONSE_BODY_EQ(data, response);

http://git-wip-us.apache.org/repos/asf/mesos/blob/8f7e303d/src/tests/gc_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/gc_tests.cpp b/src/tests/gc_tests.cpp
index ec27ac7..3570170 100644
--- a/src/tests/gc_tests.cpp
+++ b/src/tests/gc_tests.cpp
@@ -465,7 +465,7 @@ TEST_F(GarbageCollectorIntegrationTest, ExitedFramework)
   process::UPID filesUpid("files", process::address());
   AWAIT_EXPECT_RESPONSE_STATUS_EQ(
       process::http::NotFound().status,
-      process::http::get(filesUpid, "browse.json", "path=" + frameworkDir));
+      process::http::get(filesUpid, "browse", "path=" + frameworkDir));
 
   Clock::resume();
 
@@ -566,7 +566,7 @@ TEST_F(GarbageCollectorIntegrationTest, ExitedExecutor)
   process::UPID files("files", process::address());
   AWAIT_EXPECT_RESPONSE_STATUS_EQ(
       process::http::NotFound().status,
-      process::http::get(files, "browse.json", "path=" + executorDir));
+      process::http::get(files, "browse", "path=" + executorDir));
 
   Clock::resume();
 
@@ -681,7 +681,7 @@ TEST_F(GarbageCollectorIntegrationTest, DiskUsage)
   process::UPID files("files", process::address());
   AWAIT_EXPECT_RESPONSE_STATUS_EQ(
       process::http::NotFound().status,
-      process::http::get(files, "browse.json", "path=" + executorDir));
+      process::http::get(files, "browse", "path=" + executorDir));
 
   Clock::resume();
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/8f7e303d/src/webui/master/static/browse.html
----------------------------------------------------------------------
diff --git a/src/webui/master/static/browse.html 
b/src/webui/master/static/browse.html
index 0904c87..6b18056 100644
--- a/src/webui/master/static/browse.html
+++ b/src/webui/master/static/browse.html
@@ -68,7 +68,7 @@
             </td>
             <td>
               <a data-ng-show="file.mode[0] != 'd'"
-                 
href="//{{slave_host}}/files/download.json?path={{encodeURIComponent(file.path)}}">
+                 
href="//{{slave_host}}/files/download?path={{encodeURIComponent(file.path)}}">
                 <button class="btn btn-xs btn-default" type="button">
                   Download
                 </button>

http://git-wip-us.apache.org/repos/asf/mesos/blob/8f7e303d/src/webui/master/static/js/controllers.js
----------------------------------------------------------------------
diff --git a/src/webui/master/static/js/controllers.js 
b/src/webui/master/static/js/controllers.js
index 8193a44..c4340ab 100644
--- a/src/webui/master/static/js/controllers.js
+++ b/src/webui/master/static/js/controllers.js
@@ -14,7 +14,7 @@
   // Invokes the pailer for the specified host and path using the
   // specified window_title.
   function pailer(host, path, window_title) {
-    var url = '//' + host + '/files/read.json?path=' + path;
+    var url = '//' + host + '/files/read?path=' + path;
     var pailer =
       window.open('/static/pailer.html', url, 'width=580px, height=700px');
 

Reply via email to