我有以下代码要执行:
import akka.actor.ActorSystem
import spray.routing.SimpleRoutingApp
import spray.json.DefaultJsonProtocol._
object Server1 extends App with SimpleRoutingApp{
def testing(p:String,q:String){
println(p+" "+q)
}
implicit val actorSystem = ActorSystem()
var state:String=""
startServer(interface="localhost",port = 8080){
println("Listening...")
get{
println("incoming..")
path("state"){
parameters("alertC".as[String],"alertB".as[String]){ (alertC,alertB)=>{
complete{
testing(alertC,alertB)
}
}
}
}
}
}
}
在编译时错误是: 找不到参数marshaller的隐含值:spray.httpx.marshalling.ToResponseMarshaller [Unit] 错误:testing(alertC,alertB)
答案 0 :(得分:0)
Spray找不到Unit
的编组。例如,从testing
返回一个字符串。