Permalink
Browse files

Change UI createHandler routines to createServlet since they now retu…

…rn servlets
  • Loading branch information...
1 parent 2f77147 commit 4a57acc4f4b96067a19538ed7c06504de31d9025 @tgravescs tgravescs committed Mar 3, 2014
@@ -47,7 +47,7 @@ class MetricsServlet(val property: Properties, val registry: MetricRegistry) ext
def getHandlers = Array[ServletContextHandler](
JettyUtils.createServletHandler(servletPath,
- JettyUtils.createHandler(request => getMetricsSnapshot(request), "text/json"))
+ JettyUtils.createServlet(request => getMetricsSnapshot(request), "text/json"))
)
def getMetricsSnapshot(request: HttpServletRequest): String = {
@@ -46,16 +46,16 @@ private[spark] object JettyUtils extends Logging {
type Responder[T] = HttpServletRequest => T
// Conversions from various types of Responder's to jetty Handlers
- implicit def jsonResponderToHandler(responder: Responder[JValue]): HttpServlet =
- createHandler(responder, "text/json", (in: JValue) => pretty(render(in)))
+ implicit def jsonResponderToServlet(responder: Responder[JValue]): HttpServlet =
+ createServlet(responder, "text/json", (in: JValue) => pretty(render(in)))
- implicit def htmlResponderToHandler(responder: Responder[Seq[Node]]): HttpServlet =
- createHandler(responder, "text/html", (in: Seq[Node]) => "<!DOCTYPE html>" + in.toString)
+ implicit def htmlResponderToServlet(responder: Responder[Seq[Node]]): HttpServlet =
+ createServlet(responder, "text/html", (in: Seq[Node]) => "<!DOCTYPE html>" + in.toString)
- implicit def textResponderToHandler(responder: Responder[String]): HttpServlet =
- createHandler(responder, "text/plain")
+ implicit def textResponderToServlet(responder: Responder[String]): HttpServlet =
+ createServlet(responder, "text/plain")
- def createHandler[T <% AnyRef](responder: Responder[T], contentType: String,
+ def createServlet[T <% AnyRef](responder: Responder[T], contentType: String,
extractFn: T => String = (in: Any) => in.toString): HttpServlet = {
new HttpServlet {
override def doGet(request: HttpServletRequest,

0 comments on commit 4a57acc

Please sign in to comment.