[GitHub] [spark] ajithme commented on a change in pull request #24088: [SPARK-27122][core] Jetty classes must not be return via getters in org.apache.spark.ui.WebUI

2019-03-15 Thread GitBox
ajithme commented on a change in pull request #24088: [SPARK-27122][core] Jetty 
classes must not be return via getters in org.apache.spark.ui.WebUI
URL: https://github.com/apache/spark/pull/24088#discussion_r265929186
 
 

 ##
 File path: core/src/main/scala/org/apache/spark/ui/WebUI.scala
 ##
 @@ -95,6 +101,15 @@ private[spark] abstract class WebUI(
 serverInfo.foreach(_.addHandler(handler, securityManager))
   }
 
+  /** Attaches a handler to this UI. */
+  def attachHandler(contextPath: String, httpServlet: HttpServlet, pathSpec: 
String): Unit =
+synchronized {
 
 Review comment:
   You are right. updated


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] [spark] ajithme commented on a change in pull request #24088: [SPARK-27122][core] Jetty classes must not be return via getters in org.apache.spark.ui.WebUI

2019-03-15 Thread GitBox
ajithme commented on a change in pull request #24088: [SPARK-27122][core] Jetty 
classes must not be return via getters in org.apache.spark.ui.WebUI
URL: https://github.com/apache/spark/pull/24088#discussion_r265929062
 
 

 ##
 File path: core/src/main/scala/org/apache/spark/ui/WebUI.scala
 ##
 @@ -193,3 +208,32 @@ private[spark] abstract class WebUIPage(var prefix: 
String) {
   def render(request: HttpServletRequest): Seq[Node]
   def renderJson(request: HttpServletRequest): JValue = JNothing
 }
+
+private[spark] class DelegatingServletContextHandler(handler: 
ServletContextHandler) {
+
+  def prependFilterMapping(
+  filterName: String,
+  spec: String,
+  types: EnumSet[DispatcherType]): Unit = {
+val mapping = new FilterMapping
 
 Review comment:
   updated


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] [spark] ajithme commented on a change in pull request #24088: [SPARK-27122][core] Jetty classes must not be return via getters in org.apache.spark.ui.WebUI

2019-03-15 Thread GitBox
ajithme commented on a change in pull request #24088: [SPARK-27122][core] Jetty 
classes must not be return via getters in org.apache.spark.ui.WebUI
URL: https://github.com/apache/spark/pull/24088#discussion_r265902446
 
 

 ##
 File path: core/src/main/scala/org/apache/spark/ui/WebUI.scala
 ##
 @@ -95,6 +101,16 @@ private[spark] abstract class WebUI(
 serverInfo.foreach(_.addHandler(handler, securityManager))
   }
 
+  /** Attaches a handler to this UI. */
+  def attachHandler(contextPath: String,
 
 Review comment:
   @vanzin I have run scalafmt on modified class and updated the PR. Is it ok 
now.?


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] [spark] ajithme commented on a change in pull request #24088: [SPARK-27122][core] Jetty classes must not be return via getters in org.apache.spark.ui.WebUI

2019-03-14 Thread GitBox
ajithme commented on a change in pull request #24088: [SPARK-27122][core] Jetty 
classes must not be return via getters in org.apache.spark.ui.WebUI
URL: https://github.com/apache/spark/pull/24088#discussion_r265820907
 
 

 ##
 File path: core/src/main/scala/org/apache/spark/ui/WebUI.scala
 ##
 @@ -95,6 +101,16 @@ private[spark] abstract class WebUI(
 serverInfo.foreach(_.addHandler(handler, securityManager))
   }
 
+  /** Attaches a handler to this UI. */
+  def attachNewHandler(contextPath: String,
+   httpServlet: HttpServlet,
+   pathSpec: String): Unit = synchronized {
+val ctx = new ServletContextHandler()
+ctx.setContextPath("/new-handler")
 
 Review comment:
   Done


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] [spark] ajithme commented on a change in pull request #24088: [SPARK-27122][core] Jetty classes must not be return via getters in org.apache.spark.ui.WebUI

2019-03-14 Thread GitBox
ajithme commented on a change in pull request #24088: [SPARK-27122][core] Jetty 
classes must not be return via getters in org.apache.spark.ui.WebUI
URL: https://github.com/apache/spark/pull/24088#discussion_r265820927
 
 

 ##
 File path: core/src/main/scala/org/apache/spark/ui/WebUI.scala
 ##
 @@ -193,3 +209,30 @@ private[spark] abstract class WebUIPage(var prefix: 
String) {
   def render(request: HttpServletRequest): Seq[Node]
   def renderJson(request: HttpServletRequest): JValue = JNothing
 }
+
+private[spark] class DelegatingServletContextHandler(servletContextHandler: 
ServletContextHandler) {
+
+  def prependFilterMapping(filterName: String,
+   spec: String,
+   types: EnumSet[DispatcherType]): Unit = {
+val mapping = new FilterMapping()
+mapping.setFilterName(filterName)
+mapping.setPathSpec(spec)
+mapping.setDispatcherTypes(EnumSet.allOf(classOf[DispatcherType]))
+servletContextHandler.getServletHandler.prependFilterMapping(mapping)
+  }
+
+  def addFilter(filterName: String,
+className: String,
+filterParams: Map[String, String]): Unit = {
+val filterHolder = new FilterHolder()
+filterHolder.setName(filterName)
+filterHolder.setClassName(className)
+filterParams.foreach { case (k, v) => filterHolder.setInitParameter(k, v) }
+servletContextHandler.getServletHandler.addFilter(filterHolder)
+  }
+
+  def filterSize(): Int = {
 
 Review comment:
   Done


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] [spark] ajithme commented on a change in pull request #24088: [SPARK-27122][core] Jetty classes must not be return via getters in org.apache.spark.ui.WebUI

2019-03-14 Thread GitBox
ajithme commented on a change in pull request #24088: [SPARK-27122][core] Jetty 
classes must not be return via getters in org.apache.spark.ui.WebUI
URL: https://github.com/apache/spark/pull/24088#discussion_r265820885
 
 

 ##
 File path: core/src/main/scala/org/apache/spark/ui/WebUI.scala
 ##
 @@ -193,3 +209,30 @@ private[spark] abstract class WebUIPage(var prefix: 
String) {
   def render(request: HttpServletRequest): Seq[Node]
   def renderJson(request: HttpServletRequest): JValue = JNothing
 }
+
+private[spark] class DelegatingServletContextHandler(servletContextHandler: 
ServletContextHandler) {
 
 Review comment:
   i have renamed


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] [spark] ajithme commented on a change in pull request #24088: [SPARK-27122][core] Jetty classes must not be return via getters in org.apache.spark.ui.WebUI

2019-03-14 Thread GitBox
ajithme commented on a change in pull request #24088: [SPARK-27122][core] Jetty 
classes must not be return via getters in org.apache.spark.ui.WebUI
URL: https://github.com/apache/spark/pull/24088#discussion_r265820844
 
 

 ##
 File path: core/src/main/scala/org/apache/spark/ui/WebUI.scala
 ##
 @@ -95,6 +101,16 @@ private[spark] abstract class WebUI(
 serverInfo.foreach(_.addHandler(handler, securityManager))
   }
 
+  /** Attaches a handler to this UI. */
+  def attachNewHandler(contextPath: String,
 
 Review comment:
   Done. Changed Formatting and Method name


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] [spark] ajithme commented on a change in pull request #24088: [SPARK-27122][core] Jetty classes must not be return via getters in org.apache.spark.ui.WebUI

2019-03-14 Thread GitBox
ajithme commented on a change in pull request #24088: [SPARK-27122][core] Jetty 
classes must not be return via getters in org.apache.spark.ui.WebUI
URL: https://github.com/apache/spark/pull/24088#discussion_r265820781
 
 

 ##
 File path: core/src/main/scala/org/apache/spark/ui/WebUI.scala
 ##
 @@ -59,6 +61,10 @@ private[spark] abstract class WebUI(
   def getTabs: Seq[WebUITab] = tabs
   def getHandlers: Seq[ServletContextHandler] = handlers
 
+  def getDelegatingHandlers: Seq[DelegatingServletContextHandler] = {
+handlers.map(handler => new DelegatingServletContextHandler(handler))
 
 Review comment:
   Updated


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org