spray-session
spray-session copied to clipboard
Problem when integrating with spray session
Hi, I keep getting the error:
not enough arguments for method cookieSession: (magnet: com.abcd.rest.session.WithStatefulManagerMagnet[Unit,Int])spray.routing.Directive[shapeless.::[String,shapeless.::[Map[String,Int],shapeless.HNil]]]
when trying to integrate spray session with my code. It seems that it's because my code is lack of some implicit parameter so the compiler is unable to find the suitable conversation. I am pretty new to Scala and spray (magnet directive pattern). Can you take a look and suggest where I made the mistake.
Here is the code what I am using:
trait BootedCore extends HttpService with HttpsDirectives with SettingsProvider with PageDirectives with StatefulSessionManagerDirectives[Int]{
implicit val system = ActorSystem("user-services")
....
implicit def actorRefFactory: ActorRefFactory = system
implicit val timeout = new Timeout(Duration(2, SECONDS))
implicit val manager = new RedisSessionManager[Int](ConfigFactory.load())
//merge both routes together + enforce https if needed
val routes = {
cookieSession() { (id, map) =>
decompressCompressIfRequested {
enforceHttpsIf(settings.Http.EnforceHttps) {
apiRoutes ~ websiteRoutes
}
}
}
}
....
Thanks.
Hi,
Aren't you missing an implicit ExecutionContext
in scope?