diff options
author | witgo <witgo@qq.com> | 2014-03-18 21:57:47 -0700 |
---|---|---|
committer | Patrick Wendell <pwendell@gmail.com> | 2014-03-18 21:57:47 -0700 |
commit | cc2655a237442a71c75d4fade99767df7648e55f (patch) | |
tree | 2eb97ce44a7715e63aaba48e17409d66c686b63c | |
parent | f9d8a83c0006bb59c61e8770cd201b72333cb9a4 (diff) | |
download | spark-cc2655a237442a71c75d4fade99767df7648e55f.tar.gz spark-cc2655a237442a71c75d4fade99767df7648e55f.tar.bz2 spark-cc2655a237442a71c75d4fade99767df7648e55f.zip |
Fix SPARK-1256: Master web UI and Worker web UI returns a 404 error
Author: witgo <witgo@qq.com>
Closes #150 from witgo/SPARK-1256 and squashes the following commits:
08044a2 [witgo] Merge branch 'master' of https://github.com/apache/spark into SPARK-1256
c99b030 [witgo] Fix SPARK-1256
4 files changed, 7 insertions, 4 deletions
diff --git a/core/src/main/scala/org/apache/spark/deploy/master/ui/MasterWebUI.scala b/core/src/main/scala/org/apache/spark/deploy/master/ui/MasterWebUI.scala index a7bd01e284..4ad1f95be3 100644 --- a/core/src/main/scala/org/apache/spark/deploy/master/ui/MasterWebUI.scala +++ b/core/src/main/scala/org/apache/spark/deploy/master/ui/MasterWebUI.scala @@ -61,7 +61,7 @@ class MasterWebUI(val master: Master, requestedPort: Int) extends Logging { master.applicationMetricsSystem.getServletHandlers val handlers = metricsHandlers ++ Seq[ServletContextHandler]( - createStaticHandler(MasterWebUI.STATIC_RESOURCE_DIR, "/static/*"), + createStaticHandler(MasterWebUI.STATIC_RESOURCE_DIR + "/static", "/static"), createServletHandler("/app/json", createServlet((request: HttpServletRequest) => applicationPage.renderJson(request), master.securityMgr)), diff --git a/core/src/main/scala/org/apache/spark/deploy/worker/ui/WorkerWebUI.scala b/core/src/main/scala/org/apache/spark/deploy/worker/ui/WorkerWebUI.scala index ffc05bd306..4e33b330ad 100644 --- a/core/src/main/scala/org/apache/spark/deploy/worker/ui/WorkerWebUI.scala +++ b/core/src/main/scala/org/apache/spark/deploy/worker/ui/WorkerWebUI.scala @@ -47,7 +47,7 @@ class WorkerWebUI(val worker: Worker, val workDir: File, requestedPort: Option[I val metricsHandlers = worker.metricsSystem.getServletHandlers val handlers = metricsHandlers ++ Seq[ServletContextHandler]( - createStaticHandler(WorkerWebUI.STATIC_RESOURCE_BASE, "/static/*"), + createStaticHandler(WorkerWebUI.STATIC_RESOURCE_BASE + "/static", "/static"), createServletHandler("/log", createServlet((request: HttpServletRequest) => log(request), worker.securityMgr)), createServletHandler("/logPage", createServlet((request: HttpServletRequest) => logPage diff --git a/core/src/main/scala/org/apache/spark/ui/JettyUtils.scala b/core/src/main/scala/org/apache/spark/ui/JettyUtils.scala index 7c35cd165a..e0555ca7ac 100644 --- a/core/src/main/scala/org/apache/spark/ui/JettyUtils.scala +++ b/core/src/main/scala/org/apache/spark/ui/JettyUtils.scala @@ -111,10 +111,13 @@ private[spark] object JettyUtils extends Logging { Option(getClass.getClassLoader.getResource(resourceBase)) match { case Some(res) => holder.setInitParameter("resourceBase", res.toString) + holder.setInitParameter("welcomeServlets", "false") + holder.setInitParameter("pathInfoOnly", "false") case None => throw new Exception("Could not find resource path for Web UI: " + resourceBase) } - contextHandler.addServlet(holder, path) + contextHandler.setContextPath(path) + contextHandler.addServlet(holder, "/") contextHandler } diff --git a/core/src/main/scala/org/apache/spark/ui/SparkUI.scala b/core/src/main/scala/org/apache/spark/ui/SparkUI.scala index ca82c3da2f..5f0dee64fe 100644 --- a/core/src/main/scala/org/apache/spark/ui/SparkUI.scala +++ b/core/src/main/scala/org/apache/spark/ui/SparkUI.scala @@ -38,7 +38,7 @@ private[spark] class SparkUI(sc: SparkContext) extends Logging { var server: Option[Server] = None val handlers = Seq[ServletContextHandler] ( - createStaticHandler(SparkUI.STATIC_RESOURCE_DIR, "/static/*"), + createStaticHandler(SparkUI.STATIC_RESOURCE_DIR + "/static", "/static"), createRedirectHandler("/stages", "/") ) val storage = new BlockManagerUI(sc) |