Query parameter reformatted to be more extensible and routing more robust
This commit is contained in:
parent
0da2ff102e
commit
bf9d9946f9
|
@ -22,13 +22,13 @@ class MasterWebUI(val actorSystem: ActorSystem, master: ActorRef) extends Direct
|
|||
|
||||
val handler = {
|
||||
get {
|
||||
(path("") & parameters('json ?)) {
|
||||
case Some(js) =>
|
||||
(path("") & parameters('format ?)) {
|
||||
case Some(js) if js.equalsIgnoreCase("json") =>
|
||||
val future = master ? RequestMasterState
|
||||
respondWithMediaType(MediaTypes.`application/json`) { ctx =>
|
||||
ctx.complete(future.mapTo[MasterState])
|
||||
}
|
||||
case None =>
|
||||
case _ =>
|
||||
completeWith {
|
||||
val future = master ? RequestMasterState
|
||||
future.map {
|
||||
|
|
|
@ -21,14 +21,14 @@ class WorkerWebUI(val actorSystem: ActorSystem, worker: ActorRef) extends Direct
|
|||
|
||||
val handler = {
|
||||
get {
|
||||
(path("") & parameters('json ?)) {
|
||||
case Some(js) => {
|
||||
(path("") & parameters('format ?)) {
|
||||
case Some(js) if js.equalsIgnoreCase("json") => {
|
||||
val future = worker ? RequestWorkerState
|
||||
respondWithMediaType(MediaTypes.`application/json`) { ctx =>
|
||||
ctx.complete(future.mapTo[WorkerState])
|
||||
}
|
||||
}
|
||||
case None =>
|
||||
case _ =>
|
||||
completeWith{
|
||||
val future = worker ? RequestWorkerState
|
||||
future.map { workerState =>
|
||||
|
|
Loading…
Reference in a new issue